By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

If Me!Obj = 5100 Then runtime error 13

P: n/a
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

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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" <jw*****@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 13 '05 #2

P: n/a
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

Nov 13 '05 #3

P: n/a
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" <jw*****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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

Nov 13 '05 #4

P: n/a
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.

Nov 13 '05 #5

P: n/a
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" <jw*****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.