Hi everyone,
I'm trying to add a record to a table using the SQL INSERT statement, but somehow it's not working..
I have declared in a standard module some public variables, which are populated during data entry. After the data entry, I want to save a record using the public variables, but when the statement is executed I'm asked to supply values for the public variables.
Before the INSERT statement, I use msgbox to display the values and they are there, yet I'm being asked to enter values.
/code ****************
Private Sub da_Click()
MsgBox "<<<< setapptfrm >>>"
MsgBox "patient no >> " & strpatientno
MsgBox "Surname >> " & strpsname
MsgBox "first name >> " & strpfname
MsgBox "date of birth >> " & dtdob
MsgBox "address >> " & straddress
DoCmd.RunSQL "INSERT INTO tblappointments ([apptdate], [patientno], [pfname], [psname], [address],[dob]) VALUES ([cboapptdate],[strpatientno],[strpfname],[strpsname],[straddress],[dtdob]);"
DoCmd.Requery
stDocName = "frmpatientappointments"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
/code ********************
Any ideas?
Thanks
Will
I'm trying to add a record to a table using the SQL INSERT statement, but somehow it's not working..
I have declared in a standard module some public variables, which are populated during data entry. After the data entry, I want to save a record using the public variables, but when the statement is executed I'm asked to supply values for the public variables.
Before the INSERT statement, I use msgbox to display the values and they are there, yet I'm being asked to enter values.
/code ****************
Private Sub da_Click()
MsgBox "<<<< setapptfrm >>>"
MsgBox "patient no >> " & strpatientno
MsgBox "Surname >> " & strpsname
MsgBox "first name >> " & strpfname
MsgBox "date of birth >> " & dtdob
MsgBox "address >> " & straddress
DoCmd.RunSQL "INSERT INTO tblappointments ([apptdate], [patientno], [pfname], [psname], [address],[dob]) VALUES ([cboapptdate],[strpatientno],[strpfname],[strpsname],[straddress],[dtdob]);"
DoCmd.Requery
stDocName = "frmpatientappointments"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
/code ********************
Any ideas?
Thanks
Will