View Full Version : SQL displaying from wrong column in table?


RCheesley
06-01-2009, 01:55 AM
Morning all,

I've got a query which is running a search box on a form (which I lifted from an example posted here incidentally) but it's picking up the GP as the ID number and not the actual GP surgery. Is there any way I can get around this, perhaps by using DLookup or something?


SELECT qrysearch.PatientDetailsNHSNo, qrysearch.PatientDetailsDoB AS [Date of Birth], [PatientDetailsSurname] & ", " & [PatientDetailsFirstName] AS [Patient Name], [PatientDetailsGP] AS [GP Surgery] FROM qrysearch WHERE (((qrysearch.PatientDetailsNHSNo) Like "*" & Forms!frmstartscreen!txtSearch2 & "*")) Or ((([PatientDetailsFirstName] & ", " & [PatientDetailsSurname]) Like "*" & Forms!frmstartscreen!txtSearch2 & "*"));

MrQ
06-01-2009, 01:38 PM
Could you not change PatientDetailsGP in your query for the correct value?

Hope this helps

Q