Hello
I am having a problem with an append query. I want my database to create a single new record in a table using values from another. I guess an append query is used for this.
I have this so far:
INSERT INTO jun_waitingevent ( waitinglistevent_ID, offdate, waitinglistIDFK, patientIDFK )
SELECT jun_waitingevent.waitinglistevent_ID, jun_individualevent.startdate, jun_individualevent.individualIDFK, jun_individualevent.patientIDFK
FROM (tbl_patientdetails INNER JOIN jun_individualevent ON tbl_patientdetails.patientID = jun_individualevent.patientIDFK) INNER JOIN jun_waitingevent ON tbl_patientdetails.patientID = jun_waitingevent.patientIDFK
WHERE (((tbl_patientdetails.patientID)=[Forms]![frm_patientdetails]![sf_jun_individualevent].[Form]![patientIDFK]));
It is trigger in an after update event on a form. The form consists of a main form with three subforms on tabs. The user enters a start date for therapy, then, if no matching waiting list is available for that specific patient (I have a bit of code that works this out), the append query is run. It is meant to take the start date of the therapy and create a new record of a waiting list event, with the start date of therapy becoming the date when the patient was removed from the newly created waiting list event. The append query is also meant to take the therapy type foreign key (individualIDFK) and use it as the therapy type foreign key in the waiting list event table (waitinglistIDFK).
Every time the above query is run, it appends 0 records. What am I doing wrong? Am I an idiot?
thanks
Bruce
I am having a problem with an append query. I want my database to create a single new record in a table using values from another. I guess an append query is used for this.
I have this so far:
INSERT INTO jun_waitingevent ( waitinglistevent_ID, offdate, waitinglistIDFK, patientIDFK )
SELECT jun_waitingevent.waitinglistevent_ID, jun_individualevent.startdate, jun_individualevent.individualIDFK, jun_individualevent.patientIDFK
FROM (tbl_patientdetails INNER JOIN jun_individualevent ON tbl_patientdetails.patientID = jun_individualevent.patientIDFK) INNER JOIN jun_waitingevent ON tbl_patientdetails.patientID = jun_waitingevent.patientIDFK
WHERE (((tbl_patientdetails.patientID)=[Forms]![frm_patientdetails]![sf_jun_individualevent].[Form]![patientIDFK]));
It is trigger in an after update event on a form. The form consists of a main form with three subforms on tabs. The user enters a start date for therapy, then, if no matching waiting list is available for that specific patient (I have a bit of code that works this out), the append query is run. It is meant to take the start date of the therapy and create a new record of a waiting list event, with the start date of therapy becoming the date when the patient was removed from the newly created waiting list event. The append query is also meant to take the therapy type foreign key (individualIDFK) and use it as the therapy type foreign key in the waiting list event table (waitinglistIDFK).
Every time the above query is run, it appends 0 records. What am I doing wrong? Am I an idiot?
thanks
Bruce