distinguish letters from numbers (1 Viewer)

lala

Registered User.
Local time
Today, 12:54
Joined
Mar 20, 2002
Messages
741
i have a text box and i need to know what the user typed in, letters or numbers, is that possible?
 

thunder

Just Want To Know More
Local time
Today, 09:54
Joined
Feb 28, 2009
Messages
26
may i ask if what you are asking about (letters) and (numbers) or letters as text an numbers which are involved in calculations
 

lala

Registered User.
Local time
Today, 12:54
Joined
Mar 20, 2002
Messages
741
not sure which one i need

i have a search box that accepts user input and then searches 6 fields for that input

the problem is that 2 of the fields are text fields with long names of hospitals, and most of the time user will only enter part of the name
with numbers, however, it's exactly what they put in - they should get in the results

but when i try to put that in one query it doesn't work
it only works if they're all partial searches or all full searches

so i thought i'd see what they type in and depending on what they're searching for, use 1 of 2 filters

is there a better way? i know mine is just a workaround
 

thunder

Just Want To Know More
Local time
Today, 09:54
Joined
Feb 28, 2009
Messages
26
of what i understood being not one of english native speakers i would say and suggest that by a simple query in design mode and under the hospital name in the criteria feild you put
LIKE plus * and any part of the name of the hospital
if that was the answer its ok
if not , inform me to know
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 17:54
Joined
Sep 12, 2006
Messages
15,690
if isnumeric(myfield) then
msgbox("numeric")
else
msgbox("alpha/alpha-numeric")
end if
 

Brianwarnock

Retired
Local time
Today, 17:54
Joined
Jun 2, 2003
Messages
12,701
Assuming that the search box is on a form your Where clauses will look like this

Code:
((IIf(IsNumeric([fieldname]),[fieldname]=[forms]![formname]![textboxname],[fieldname] Like "*" & [forms]![formname]![textboxname] & "*")=True)=True)

Brian
 

lala

Registered User.
Local time
Today, 12:54
Joined
Mar 20, 2002
Messages
741
thank you, Brian and thank you Gemma
Gemma, i saw your reply but couldn't answer

as i understand, you're both giving me solutions, one for VB and one as a query
 

Brianwarnock

Retired
Local time
Today, 17:54
Joined
Jun 2, 2003
Messages
12,701
Yes my code was for use in a query, Gemma was showing how to check the field contents in VB.

Brian
 

Users who are viewing this thread

Top Bottom