Then the following query statement works fine. But I need to add an extra area to check, is it possible?
So if FIELD1 or FIELD2 is in combo254.text, then select those records.
> Here's the current query I'm running: Connect with each Additional criteria with the term As a side note, VBA allows you to double quotation marks to include quotation marks in literal strings. I think this is slightly more readable than using Chr (34). Temp = Combo254.Text Dim strSQL string strrowhere as string strWhere = (Chr (34) + Combo254 .Text + (Chr (34)) StrSQL = "SELECT * FROM MainQuery WHERE [FIELD1]" Like & amp; StrWhere 'MsgBox (strSQL) [Form_Main] .RecordSource = strSQL
and or
OR .
strSQL = "Select + From the main menu" & amp; _ "Where" [FIELD1] like "&" Combo 254 Text & amp; "" "Or" & amp; _ "[FIELD2] such as" "" & amp; Combo 254 Text & amp; In this situation, access is ignored so that you use single quotes or double quotes, so that you can rewrite the query in this way. :
strSQL = "SELECT * FROM Mainclin" & amp; _ "" Like & [FIELD1] like "& amp; combo 254. Text & amp;" 'or' & amp; _ "Like" [FIELD2] "& amp; combo 254. Text & amp;" '"
No comments:
Post a Comment