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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax missing operator 2

Status
Not open for further replies.

SeadnaS

Programmer
May 30, 2011
214
Keep getting a Syntax Error missing operator message on the following code:

Size_Type = '13010' And WHERE TP = 'BP'

Don't know whats wrong with it.

Heres the full code from VBA:

Me!lotbox.RowSource = "SELECT LOT_NO FROM " & Me.RecordSource & " WHERE Size_Type = '" & Me.sizecombo & "' And WHERE TP ='" & Me!typecombo & "'
 
I don't think you need the second WHERE.

I think:

Me!lotbox.RowSource = "SELECT LOT_NO FROM " & Me.RecordSource & " WHERE Size_Type = '" & Me.sizecombo & "' And TP ='" & Me!typecombo & "'"

would be sufficient.
 

I think BigRed is into something, but I would also recomend something like this:
[tt]
Dim strSQL As String

strSQL = "SELECT LOT_NO FROM " & Me.RecordSource & " WHERE Size_Type = '" & Me.sizecombo & "' And TP ='" & Me!typecombo & "'"

Debug.Print strSQL

Me!lotbox.RowSource = strSQL[/tt]

This way it is easy to see what SQL you are trying to run.

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top