I'm working on a database that will review patient records with a series of questions. I have a form for a new review that contains a subform with the questions. The questions are linked to the review id, so when generating the questions, I need the insert the current review id into each new record in the subform's database.
When I run this code, it doesn't recognize the control on the main form that contains the current review number and just doesn't insert records into the tblanswers table. When I print the current review number in the Immediate window, it properly identifies the current review.
' Add data to new records, pulling Review_ID control in Main Form
dbs.Execute "Insert into tblAnswers " _
& "(Reviews_ID, Question_id) " _
& "Values (Forms![frmChart Reviews]![Review_ID].Value, " _
& "" & IntegerCounter & ");"
I receive the Microsoft Visual Basic error:
Run-time error '3061':
Too few parameters. Expected 1.
I think it is pointing to the last line.
Obviously, I'm new to VBA...
When I run this code, it doesn't recognize the control on the main form that contains the current review number and just doesn't insert records into the tblanswers table. When I print the current review number in the Immediate window, it properly identifies the current review.
' Add data to new records, pulling Review_ID control in Main Form
dbs.Execute "Insert into tblAnswers " _
& "(Reviews_ID, Question_id) " _
& "Values (Forms![frmChart Reviews]![Review_ID].Value, " _
& "" & IntegerCounter & ");"
I receive the Microsoft Visual Basic error:
Run-time error '3061':
Too few parameters. Expected 1.
I think it is pointing to the last line.
Obviously, I'm new to VBA...