I am using Access 2010 and am trying to execute a pass through query from a form where a date in entered. The query looks like this:
SELECT RTRIM(name.last_name) +', ' + name.first_name AS Name, name.soc_sec AS ID, address.st_addr, address.add_addr,RTRIM( address.city) + ', ' + address.state + ' ' + address.zip AS CtySTZip, address.e_mail, address.e_mail2, address.phone, address.cell_phone, nmprg.prg_cod, dispos.disp_date, approg.entry_date
FROM name, address, nmprg, dispos, approg
WHERE approg.entry_date = [Forms]![ParameterForm]![EntryDate]
AND name.soc_sec = address.soc_sec
AND name.soc_sec = nmprg.soc_sec
AND name.soc_sec = dispos.soc_sec
AND name.soc_sec = approg.soc_sec
AND address.preferred = '1'
AND nmprg.active = '1'
AND dispos.CurDispos = '1'
AND dispos.dispos in ('Depostied', 'Enrolled')
I get ODBC - call failed. Incorrect syntax near '!' (#102).
What am I doing wrong? Is there a better way to pass a parameter?
SELECT RTRIM(name.last_name) +', ' + name.first_name AS Name, name.soc_sec AS ID, address.st_addr, address.add_addr,RTRIM( address.city) + ', ' + address.state + ' ' + address.zip AS CtySTZip, address.e_mail, address.e_mail2, address.phone, address.cell_phone, nmprg.prg_cod, dispos.disp_date, approg.entry_date
FROM name, address, nmprg, dispos, approg
WHERE approg.entry_date = [Forms]![ParameterForm]![EntryDate]
AND name.soc_sec = address.soc_sec
AND name.soc_sec = nmprg.soc_sec
AND name.soc_sec = dispos.soc_sec
AND name.soc_sec = approg.soc_sec
AND address.preferred = '1'
AND nmprg.active = '1'
AND dispos.CurDispos = '1'
AND dispos.dispos in ('Depostied', 'Enrolled')
I get ODBC - call failed. Incorrect syntax near '!' (#102).
What am I doing wrong? Is there a better way to pass a parameter?