dbTalk Databases Forums  

If Me!Obj = 5100 Then runtime error 13

comp.databases.ms-access comp.databases.ms-access


Discuss If Me!Obj = 5100 Then runtime error 13 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jwa6
 
Posts: n/a

Default If Me!Obj = 5100 Then runtime error 13 - 01-07-2005 , 03:29 PM






I get an runtime error w/ this code

If Me!Obj = 5100 Then

runtime error 13
type mismatch

what is this testing for? IE: 5100

jim



Private Sub Form_Current()
DoCmd.Maximize

If Me!Obj = 5100 Then
Me.AbbrevShadow.ForeColor = 65535
Else
Me.AbbrevShadow.ForeColor = 16776960#
End If

Me!FedPerc = (Me!SubgAmt / (Me!SubgAmt + Me!MatchAmt)) * 100

If Me!FedPerc > 80 And Me![AgencyType] <> "Native Am." Then
With Me!FedPerc
..ForeColor = 255
..FontBold = True
..BackColor = RGB(255, 255, 255)
End With
ElseIf Me!FedPerc > 95 And Me![AgencyType] = "Native Am." Then
With Me!FedPerc
..ForeColor = 255
..FontBold = True
..BackColor = RGB(255, 255, 255)
End With
ElseIf Me!FedPerc <= 80 And Me![AgencyType] <> "Native Am." Then
With Me!FedPerc
..ForeColor = 0
..FontBold = False
..BackColor = RGB(255, 204, 153)
End With
ElseIf Me!FedPerc <= 95 And Me![AgencyType] = "Native Am." Then
With Me!FedPerc
..ForeColor = 0
..FontBold = False
..BackColor = RGB(255, 204, 153)
End With
End If

If Me!fsubComply![chkProjInc] = -1 Then
Me!fsubFSRdoc![cmdProjInc].Visible = True
Me!fsubFSRdoc![lblPI].Visible = True
Me!fsubFSRdoc![boxPI].Visible = True
Me!fsubFSRdoc![lblBillings].Visible = True
Me!fsubFSRdoc![lblCollections].Visible = True
Me!fsubFSRdoc![lblExpenditures].Visible = True
Me!fsubFSRdoc![Billings].Visible = True
Me!fsubFSRdoc![Collections].Visible = True
Me!fsubFSRdoc![Expenditures].Visible = True
Else
Me!fsubFSRdoc![cmdProjInc].Visible = False
Me!fsubFSRdoc![lblPI].Visible = False
Me!fsubFSRdoc![boxPI].Visible = False
Me!fsubFSRdoc![lblBillings].Visible = False
Me!fsubFSRdoc![lblCollections].Visible = False
Me!fsubFSRdoc![lblExpenditures].Visible = False
Me!fsubFSRdoc![Billings].Visible = False
Me!fsubFSRdoc![Collections].Visible = False
Me!fsubFSRdoc![Expenditures].Visible = False
End If
End Sub


Reply With Quote
  #2  
Old   
Wayne Morgan
 
Posts: n/a

Default Re: If Me!Obj = 5100 Then runtime error 13 - 01-07-2005 , 04:00 PM






It is testing for the value of the control named Obj to be 5100. While this
is a legal name for a control, it is more often used as the name of an
object variable. If that was the intent, the syntax is incorrect. The most
likely possibility is that 5100 is simply not the correct data type for the
value held in Obj. What is the data type in the table for this field? Also,
if you're using Access 2000 or newer, you may want to check into using
Conditional Formatting instead of the code to do this. You are currently
limited to 4 conditions per control (default plus 3 defined conditions) if
you use Conditional Formatting instead of code.

--
Wayne Morgan
MS Access MVP


"jwa6" <jwagans (AT) yahoo (DOT) com> wrote

Quote:
I get an runtime error w/ this code

If Me!Obj = 5100 Then

runtime error 13
type mismatch

what is this testing for? IE: 5100

jim



Private Sub Form_Current()
DoCmd.Maximize

If Me!Obj = 5100 Then
Me.AbbrevShadow.ForeColor = 65535
Else
Me.AbbrevShadow.ForeColor = 16776960#
End If

Me!FedPerc = (Me!SubgAmt / (Me!SubgAmt + Me!MatchAmt)) * 100

If Me!FedPerc > 80 And Me![AgencyType] <> "Native Am." Then
With Me!FedPerc
.ForeColor = 255
.FontBold = True
.BackColor = RGB(255, 255, 255)
End With
ElseIf Me!FedPerc > 95 And Me![AgencyType] = "Native Am." Then
With Me!FedPerc
.ForeColor = 255
.FontBold = True
.BackColor = RGB(255, 255, 255)
End With
ElseIf Me!FedPerc <= 80 And Me![AgencyType] <> "Native Am." Then
With Me!FedPerc
.ForeColor = 0
.FontBold = False
.BackColor = RGB(255, 204, 153)
End With
ElseIf Me!FedPerc <= 95 And Me![AgencyType] = "Native Am." Then
With Me!FedPerc
.ForeColor = 0
.FontBold = False
.BackColor = RGB(255, 204, 153)
End With
End If

If Me!fsubComply![chkProjInc] = -1 Then
Me!fsubFSRdoc![cmdProjInc].Visible = True
Me!fsubFSRdoc![lblPI].Visible = True
Me!fsubFSRdoc![boxPI].Visible = True
Me!fsubFSRdoc![lblBillings].Visible = True
Me!fsubFSRdoc![lblCollections].Visible = True
Me!fsubFSRdoc![lblExpenditures].Visible = True
Me!fsubFSRdoc![Billings].Visible = True
Me!fsubFSRdoc![Collections].Visible = True
Me!fsubFSRdoc![Expenditures].Visible = True
Else
Me!fsubFSRdoc![cmdProjInc].Visible = False
Me!fsubFSRdoc![lblPI].Visible = False
Me!fsubFSRdoc![boxPI].Visible = False
Me!fsubFSRdoc![lblBillings].Visible = False
Me!fsubFSRdoc![lblCollections].Visible = False
Me!fsubFSRdoc![lblExpenditures].Visible = False
Me!fsubFSRdoc![Billings].Visible = False
Me!fsubFSRdoc![Collections].Visible = False
Me!fsubFSRdoc![Expenditures].Visible = False
End If
End Sub




Reply With Quote
  #3  
Old   
jwa6
 
Posts: n/a

Default Re: If Me!Obj = 5100 Then runtime error 13 - 01-07-2005 , 04:10 PM



Thanks Wayne

too bad I really have no idea what you are talking about ....this is a
97 mdb converted to a 2003 by the way.

I dont know how to find the 'obj' ...is there a good vba book you reco?
jim


Reply With Quote
  #4  
Old   
Wayne Morgan
 
Posts: n/a

Default Re: If Me!Obj = 5100 Then runtime error 13 - 01-07-2005 , 04:16 PM



Yes. I can recommend some good books. However, to find the control named
Obj, open the form in design view, open the Properties sheet, and in the
drop down at the top of the Properties sheet select Obj then look at the
form to see which control was just highlighted. This will work if the
control name is Obj. If Obj is an object variable, then it should be defined
in the code somewhere.

For some good books,

VBA Developers Handbook
Access 2002 Developers Handbook
www.developershandbook.com

Microsoft Office Access 2003 Inside Out
http://www.viescas.com/Info/books.htm

--
Wayne Morgan
MS Access MVP


"jwa6" <jwagans (AT) yahoo (DOT) com> wrote

Quote:
Thanks Wayne

too bad I really have no idea what you are talking about ....this is a
97 mdb converted to a 2003 by the way.

I dont know how to find the 'obj' ...is there a good vba book you reco?
jim




Reply With Quote
  #5  
Old   
jwa6
 
Posts: n/a

Default Re: If Me!Obj = 5100 Then runtime error 13 - 01-07-2005 , 04:24 PM



wayne

thanks for the info...and your time.

I did find this in the macro code this error is occuring.

Private Sub Obj_BeforeUpdate(Cancel As Integer)

End Sub


this is defined as obj in the project explorer. It seems I can delet it
as it does nothing.


Reply With Quote
  #6  
Old   
Wayne Morgan
 
Posts: n/a

Default Re: If Me!Obj = 5100 Then runtime error 13 - 01-07-2005 , 06:09 PM



Ok, that definitely makes it appear that the object (textbox, combo box,
list box, etc) is named Obj. You need to figure out which object it is and
see what field it is bound to. Then check the table and see what the data
type for that field is.

--
Wayne Morgan
MS Access MVP


"jwa6" <jwagans (AT) yahoo (DOT) com> wrote

Quote:
wayne

thanks for the info...and your time.

I did find this in the macro code this error is occuring.

Private Sub Obj_BeforeUpdate(Cancel As Integer)

End Sub


this is defined as obj in the project explorer. It seems I can delet it
as it does nothing.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.