Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF, ELSE STATEMENT NOT WORKING

Status
Not open for further replies.

laman

Technical User
Jan 24, 2002
44
US
I'm using the following code to do searches with numeric and text fields.

Private Sub Command12_Click()
If " & field & " = TUBE_NO Then
strSQL = " Select * from master WHERE " & field & "" &_ operand & "" & criteria & ";"
Else
strSQL = " Select * from master WHERE " & field & "" &_ operand & "'" & criteria & "';"
End If
Me.result.RowSource = strSQL

End Sub

It skips to the else statement even though the selected field is TUBE_NO.
ANY THOUGHTS
THANKS,

 
Do you mean that TUBE_NO has literally
the characters " & field & " i.e.
"Space Ampersand space f i e l d space ampersand space" in it?
I believe that if IF ELSE is working. Re-examine what you think
If " & field & " =
is supposed to do. Compare Code (Text)
Generate Sort in VB or VBScript
 
try this
If "field" = TUBE_NO Then

notice i take the &&'s out...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top