PRodgers4284
Registered User.
- Local time
- Today, 18:01
- Joined
- Feb 17, 2009
- Messages
- 64
I have an insert statement inside i command button ("Add") on a form and the code at present adds the values from two combo boxes populated from two tables (Hospital and Ward). The insert statement inserts the values into a table called "Admission", at the minute the combo box values for the hospital and ward are being added to the Admissions table but I have added a textbox to the form called "Question" and im having difficulty inserting this textbox value into the Admissions table. Can anyone help?
The code I have at the min for the add command button is:
Private Sub btnSaveToAdmissions_Click()
Dim rs As DAO.Recordset
Dim qDef As DAO.QueryDef
Set qDef = CurrentDb.CreateQueryDef("")
qDef.SQL = "INSERT INTO Admission (WardName, HospitalName) VALUES (@WardName, @HospitalName)"
qDef.Parameters("@WardName").Value = Ward.Column(1)
qDef.Parameters("@HospitalName").Value = Hospital.Column(1)
qDef.Execute
MsgBox "Saved."
End Sub
The code I have at the min for the add command button is:
Private Sub btnSaveToAdmissions_Click()
Dim rs As DAO.Recordset
Dim qDef As DAO.QueryDef
Set qDef = CurrentDb.CreateQueryDef("")
qDef.SQL = "INSERT INTO Admission (WardName, HospitalName) VALUES (@WardName, @HospitalName)"
qDef.Parameters("@WardName").Value = Ward.Column(1)
qDef.Parameters("@HospitalName").Value = Hospital.Column(1)
qDef.Execute
MsgBox "Saved."
End Sub