I oversee an Access database that was developed before my time by someone who is no longer with the company. The DB holds patient records on inpatient stays. For the past year and a half we only been getting records from a single source, where they assign a patient ID before sending us the patient records. Our database was built around that patient ID. There are several interactive forms and tables in the DB all revolving around that ID (rebuilding the DB is not an option). We have started receiving records from other sources that need to be added to the database, however I need to figure out an automated way to create an ID for those new patients.
The new data are imported from Excel spreadsheets.
After reviewing several threads on this board, I thought maybe I could use the DMAX function to create the new IDs. So I created a master table of all the unique patients and their IDs.
My first attempt was to try an append query appending the data from the spreadsheet into the master table:
New_ID: DMax([PATIENT_IDENTIFIER],"PATIENT_IDENTIFIER_NUMBERS")+1
This worked for the first patient in the spreadsheet, but then it added that person to the master table a thousand times each with a newly created ID.
So then I appended the new patients into the master table leaving the ID blank and attempted an update query:
Update to: DMax([PATIENT_IDENTIFIER],"PATIENT_IDENTIFIER_NUMBERS",[Patient_Identifier_Final] Is Null)+1
I created a second field in the master table, "Patient_Identifier_Final," to fit the 'null' criteria. If I said where PATIENT_IDENTIFIER is null I didn't think that would work because that is the field where the query is getting the max ID from. This, however, did not work.
So now I am at a brick wall. The DMAX might not be the way to go, but I cannot find any other way of doing it.