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

Insert statement w/ Wher wildcard "11163*"

Status
Not open for further replies.

vlingen

Programmer
Aug 4, 2006
31
US
How do you write a SELECT statment when the WHERE has a wildcard in VBA?

Example:

INSERT INTO SFilterTable (ID, Field1, Field2)
SELECT Sale.ID, Sale.Field1, Sale.Field2
FROM Sale
Where Sale.Field1 = 11163*

Essentially what I have a a Find Form where the user can choose to include or exclude criteria for every field in the table. One request was to include all records where Field1 with 11163

The stament I wrote gets a syntax error.

Thanks!
 
Where Sale.Field1 Like '11163*'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried that so my exact command looks like:

INSERT INTO SalentryFilter ( SALENTRYID, ADDRESS, UNIT, TOWN, SUB, DEED_DATE, SALE_AMT, CLASS, COMMENTS, [SIZE], BLDG_SQ_FT, BLDG_STYLE, PIN, AC_SF, ENTRY_DATE, YEAR_BUILT ) SELECT SALENTRY.SALENTRYID, SALENTRY.ADDRESS, SALENTRY.UNIT, SALENTRY.TOWN, SALENTRY.SUB, SALENTRY.DEED_DATE, SALENTRY.SALE_AMT, SALENTRY.CLASS, SALENTRY.COMMENTS, SALENTRY.SIZE, SALENTRY.BLDG_SQ_FT, SALENTRY.BLDG_STYLE, SALENTRY.PIN, SALENTRY.AC_SF, SALENTRY.ENTRY_DATE, SALENTRY.YEAR_BUILT FROM Salentry WHERE Salentry![Pin] Like 11163*

But I get a Syntax error (missing operator) in query expression 'Salentry![Pin] Like 11163*', occured in CmdFilter_Click


Thanks for the help.
 
Reread my post carefuly:
Where Sale.Field1 Like [!]'[/!]11163*[!]'[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top