Access 2003 Type Mismatch Error

Can anyone tell me why I get this error, "The expression On Current you entered as the event property setting produced the following error: Type mismatch."  I get the error when the program is opened on a computer with only the Access 2003 runtime installed.  On computers with full version Access all works as expected.

This is the code I have in the On Current event.

If Me.txtD36 <= 3 Or Me.txtD36 >= 87 Then
    Me.txtD36.BackColor = 65280
    Me.txtD36.ForeColor = 0
Else
    Me.txtD36.BackColor = 2366701
    Me.txtD36.ForeColor = 16777215
End If

Any help appreciated.

Gary
garymcgowanAsked:
Who is Participating?
 
NorieConnect With a Mentor VBA ExpertCommented:
Is txtD36 a text field?

If it is try this.
If Val(Me.txtD36) <= 3 Or (Me.txtD36) >= 87 Then

Open in new window

0
 
garymcgowanAuthor Commented:
Its an unbound field

Format: Fixed
Decimal Places: 0

I tried your suggestion anyway but it didn't fix the problem.  Any other ideas?

Thanks,

Gary
0
 
NorieVBA ExpertCommented:
Gary

Does it have a value when this code runs?
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
garymcgowanAuthor Commented:
Yes, a number.  It works fine in the full version of access but not the runtime.

Gary
0
 
NorieVBA ExpertCommented:
Gary

Is that all the code?

Is there no Sub/End Sub?
0
 
garymcgowanAuthor Commented:
Private Sub Form_Current()

If Me.txtD36 <= 3 Or Me.txtD36 >= 87 Then
    Me.txtD36.BackColor = 65280
    Me.txtD36.ForeColor = 0
Else
    Me.txtD36.BackColor = 2366701
    Me.txtD36.ForeColor = 16777215
End If



End Sub
0
 
garymcgowanAuthor Commented:
The answer by imnorie did not work for me but I am giving him the points for at least trying to solve my problem.

Gary
0
All Courses

From novice to tech pro — start learning today.