K
Kurt
I would like to create a command button that, when
clicked, would:
1) PROMPT the user to enter some parameters (a start and
end date) and
2) APPEND the PatientID of records in tblPatients which
meet the parameter criteria TO the PatientID in
tblStudyEnrollment.
But because tblStudyEnrollment requires both PatientID
and StudyID, the StudyID for all of the patients being
appended needs to be updated/inserted as well (with the
value of StudyID currently listed in the form's control
[i.e., forms!frmStudies!StudyID]).
Below is the code I've come up so far. Two problems:
1) The code doesn't address the StudyID value, because I
didn't know how to call that value from the form and
insert it into the append process.
2) The current code gives this error: "Too few parameters
expected. Expected 2."
Dim db As DAO.Database
Set db = CurrentDb
db.Execute "INSERT INTO tblStudyEnrollment (
PatientID ) " & _
"SELECT tblPatients.PatientID " & _
"FROM tblPatients " & _
"WHERE (((tblPatients.DOB) Between [StartDate] And
[EndDate]));", dbFailOnError
###
Any ideas? Thanks.
Kurt
clicked, would:
1) PROMPT the user to enter some parameters (a start and
end date) and
2) APPEND the PatientID of records in tblPatients which
meet the parameter criteria TO the PatientID in
tblStudyEnrollment.
But because tblStudyEnrollment requires both PatientID
and StudyID, the StudyID for all of the patients being
appended needs to be updated/inserted as well (with the
value of StudyID currently listed in the form's control
[i.e., forms!frmStudies!StudyID]).
Below is the code I've come up so far. Two problems:
1) The code doesn't address the StudyID value, because I
didn't know how to call that value from the form and
insert it into the append process.
2) The current code gives this error: "Too few parameters
expected. Expected 2."
Dim db As DAO.Database
Set db = CurrentDb
db.Execute "INSERT INTO tblStudyEnrollment (
PatientID ) " & _
"SELECT tblPatients.PatientID " & _
"FROM tblPatients " & _
"WHERE (((tblPatients.DOB) Between [StartDate] And
[EndDate]));", dbFailOnError
###
Any ideas? Thanks.
Kurt