Hi people, will make this as easy as I can to explain.
I getting much better at access but still coming up with things I'm screwing the coding up for!!
I have a Query: [Scripts] (which is a list of patients and their prescriptions at a pharmacy)
I also have a [Patient] table that has PatientID information etc
PatientID, FirstName, LastName, Drug
I have also imported data from a DIFFERENT ([HNImport]) program via excel. Patient names are same but now in one field.
I'm trying to achieve 2 things:
- give the [HNImport] patients the Patient ID from [Scripts]
- Join [HNImport] and [Scripts] into ONE table called [Merged] which has the matching primary keys of the patients so I can do totals and stuff.
My current idea is create a Query based on [HNImport] called [QuHNImport]
It will have all the fields from the original table, plus a calculated field with a Dlookup function to find the patient ID from my original [Patients] table!!!
So my current function for this field is DLookUp("PersonID","Person","[PatientName] =" & [LastName] & " " & [FirstName])
However this isn't working at all... im getting errors and also it is asking me to put in [lastname] etc.. so it just doesn't run.
If someone can point me in the right direction that would be great!!!
What I was planning after this was to append the [HNImport] with these patient ID numbers then run a new query which created a new table combining [HNImport] and [Scripts] now both with matching Patient ID's which I can then sort and get some real data from!!!
Thanks all for reading and im looking forward to learning where im going wrong!!!
Gangel