Check if entry is number or text

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Check if entry is number or text

Post by santosm »

Hi All,
I am doing a search function on a form and would like to just use one text box for that search. I would like to use the after update event to check whether the input is a number (could be regular integer or LONG) or text. Then use that to search on different fields to filter the form. How do I check the input to see whether it is a number or text?

Thanks,
Mark
Thanks,
Mark

User avatar
HansV
Administrator
Posts: 78654
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Check if entry is number or text

Post by HansV »

You can use code like this:

Code: Select all

    If IsNumeric(Me.txtSearch) Then
        ' code for numeric values goes here
        ...
    Else
        ' code for text values goes here
        ...
    End If
where txtSearch is the text box.
Best wishes,
Hans

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Re: Check if entry is number or text

Post by santosm »

Works! Thanks!
Thanks,
Mark