Type problem - Comparing a numerical value to string value

bobby

Registered User.
Local time
Today, 20:08
Joined
Apr 29, 2004
Messages
28
I have a value of say 30 in a table - stored as integer. I have a text box on my form that finds this does a query to find this number, but of course when its stored in the text box its stored as "30".

I need to run a query saying ... Where number_in_table = number_in_form
but number_in_form is a string, so it wont work properly.

Can anyone think of a way around this ?
 
at the time of comparison use CInt() to convert the string to an integer or Clng() to convert to a long and vise-versa you can use Cstr() to convert a number to a string.
 
Text boxes are variants so you shouldn't have any trouble comparing to a numeric value if the contents of the text box is numeric. Have you done something to format the text box so that Access thinks it is a string?
 

Users who are viewing this thread

Back
Top Bottom