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!

Simple query never returns 1

Status
Not open for further replies.

ProtocolPirate

Programmer
Nov 21, 2007
104
US
The following query never returns, even though there is an index on the name field in the Patient table:

SELECT p.Name FROM sheet4 AS s INNER JOIN Patient AS p ON p.NAME LIKE s.LASTNAME + ', ' + s.FIRSTNAME + ' %'

Now I've added a field to the spreadsheet before importing it into Access such that the last field, 'argh' is "Firstname, Lastname %", so the query reads like:

SELECT p.Name FROM sheet4 AS s INNER JOIN Patient AS p ON p.NAME LIKE s.Argh

Same result, the query never returns...
 
If this is an Access query, the wild card is "*" rather than "%". You should also use & to concatenate strings rather than +.

Duane MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top