Good Day,
I need your help in the following
I want to build SQL string that adds on only if the text is not empty..
Dim Variable1,Variable2, Variable3 as string
Variable2=me.TXT2
Variable2=me.TXT3
Dim COND as string
If Len( txt1.value &"" )=0 then
Variable1= me.TXT1
COND=COND+ "FName='" & variable1 &"' "
Else
End if
If Len( txt2.value &"" )=0 then
Variable2= me.TXT2
COND=COND+ "LName='" & variable2 &"' "
Else
End if
If Len( txt3.value &"" )=0 then
Variable3= me.TXT3
COND=COND+ "MName='" & variable3 &"' "
Else
End if
Dim SQL as string
SQL="Select * from Table Where " COND
I am doing something wrong in COND. basically want to end up having SQL statement with AND condition (only if the test is filled)
Thanks for your help
I need your help in the following
I want to build SQL string that adds on only if the text is not empty..
Dim Variable1,Variable2, Variable3 as string
Variable2=me.TXT2
Variable2=me.TXT3
Dim COND as string
If Len( txt1.value &"" )=0 then
Variable1= me.TXT1
COND=COND+ "FName='" & variable1 &"' "
Else
End if
If Len( txt2.value &"" )=0 then
Variable2= me.TXT2
COND=COND+ "LName='" & variable2 &"' "
Else
End if
If Len( txt3.value &"" )=0 then
Variable3= me.TXT3
COND=COND+ "MName='" & variable3 &"' "
Else
End if
Dim SQL as string
SQL="Select * from Table Where " COND
I am doing something wrong in COND. basically want to end up having SQL statement with AND condition (only if the test is filled)
Thanks for your help