Type Mismatch (1 Viewer)

kostaskir

Registered User.
Local time
Tomorrow, 00:46
Joined
Jan 21, 2009
Messages
65
Dear friends,

I have a Run Time error 13 in the following scenario:

In my form I have a combo Box (Select_Version).

In my VBA Code I have this:

Code:
If Select_Version = 3 Or Select_Version = 6 Or Select_Version = 9 Then
    FP = 0
End If

This means that if the combo has 3, 6 or 9 values then the variable FP = 0

But sometimes the combo generates a Version which has Characters:
Example: 1C9

So, as I understand this means that the code is looking for number and receives character and BOOM !!!

Any ideas how to overtake this problem ?
Thank you in advance.
 

vbaInet

AWF VIP
Local time
Today, 22:46
Joined
Jan 22, 2010
Messages
26,374
At quick glance, if all you're testing for is equality then you can enclose the values in quotes to make them a string.

If Select_Version = "3" Or Select_Version = "6" Or Select_Version = "9" Then
 

kostaskir

Registered User.
Local time
Tomorrow, 00:46
Joined
Jan 21, 2009
Messages
65
I did it already and I don't receive the error message !
BUT the rest of the application doesn't work :D
 

kostaskir

Registered User.
Local time
Tomorrow, 00:46
Joined
Jan 21, 2009
Messages
65
I meant that the form calculates a new tax. For vehicles.
Some of these calculations didn't work properly.

BUT while I was trying some other methods yesterday. Finally I tried again the double quotes and it worked !!!!!

I can't explain it.

Thank you for your reply. :)
 

Users who are viewing this thread

Top Bottom