Help with simple If Statement

haveli1

New member
Local time
Today, 05:42
Joined
Jul 24, 2006
Messages
9
I have a search form, which has a text box. The user can type in text and then click search. The text box can have numbers or letters. It then searches for the text in a table. I was wondering if anyone knew how to write the code for the If statement. The text box can only have 4 characters.

I tried

If (VarType(Me.dnum.Value) = vbString) Then query4 = query4 & "AND [All Data Table].[Docket No] =" & Chr(34) & Me.dnum.Value & Chr(34)

but it did not work
 
Hi haveli1

If the text you are trying to append to the sql expression is the last part you are missing af ";" in the end.

Code:
If (VarType(Me.dnum.Value) = vbString) Then query4 = query4 & "AND [All Data Table].[Docket No] =" & Chr(34) & Me.dnum.Value & Chr(34) & ";"

Ørris.
 

Users who are viewing this thread

Back
Top Bottom