Solved

Access 2003 Type Mismatch Error

Posted on 2012-03-27
7
372 Views
Last Modified: 2012-08-08
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
0
Comment
Question by:garymcgowan
  • 4
  • 3
7 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 37772118
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
 

Author Comment

by:garymcgowan
ID: 37773233
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
 
LVL 33

Expert Comment

by:Norie
ID: 37773318
Gary

Does it have a value when this code runs?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:garymcgowan
ID: 37773442
Yes, a number.  It works fine in the full version of access but not the runtime.

Gary
0
 
LVL 33

Expert Comment

by:Norie
ID: 37773475
Gary

Is that all the code?

Is there no Sub/End Sub?
0
 

Author Comment

by:garymcgowan
ID: 37773588
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
 

Author Closing Comment

by:garymcgowan
ID: 38272775
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I wanted to share this with fellow Experts, who might not know. How often have you wanted to learn something, only to be set back by either restrictions imposed on "trial" or "evaluation" software?  How often have you had to rebuild a home networ…
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now