When the second occurrence of "WhereStr=WhereStr" is used and following " AND ", the first WhereStr is selected and the error message "Expected: End of Statement"
How do I overcome this error?
Private Sub BuildPOList()
Dim S As String Dim WhereStr As String
S = "Select PurchaseOrderID, VendorName, PODate From PurchaseOrderQ" WhereStr = ""
If ShowOpenPOs = True Then WhereStr = "IsOpen=true" ShowOpenPOsLabel.Caption = "Open POs" ElseIf ShowOpenPOs = False Then WhereStr = "IsOpen=false" ShowOpenPOsLabel.Caption = "Closed POs" Else ShowOpenPOsLabel.Caption = "Open && Closed POs" End If
(Compile error occurs at the beginning of the second "WhereStr=WhereStr") (When the second "WhereStr=WhereStr" is omitted, as in the elseif statement, below, the error does not occur)
................. Compile Error Expected: end of statement ................. If ShowReceivedPOs = True Then ________ If WhereStr <> "" Then WhereStr = wherstr & " AND " WhereStr=WhereStr & "PartsReceived = True" -------- _________________ ................. ShowReceivedPOsLabel.Caption = "Received POs" ElseIf ShowReceivedPOs = False Then If WhereStr <> "" Then WhereStr = wherstr & " AND " & "PartsReceived = False" (I omitted the second use of WhereStr) (and did not get the error in this statement) ShowReceivedPOsLabel.Caption = "UnReceived POs" Else ShowReceivedPOsLabel.Caption = "Received && Not" End If
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Microsoft Access 328.