shabbaranks
Registered User.
- Local time
- Today, 17:09
- Joined
- Oct 17, 2011
- Messages
- 300
Hi all..
Im trying to populate a subform "on click" of a button, based on the combo box selections from the initial form. The form looks like this:
http://i.imgur.com/iEpRo.png
And the code for the onclick is here:
Could anyone be so kind as to tell me what I am doing wrong as I get an error
Compile error - and the DoCmd SetWarnings False is highlighted.
Thanks
Im trying to populate a subform "on click" of a button, based on the combo box selections from the initial form. The form looks like this:
http://i.imgur.com/iEpRo.png
And the code for the onclick is here:
Code:
Private Sub AddToSheet_Click()
Dim sActivity As String
Dim sDepartment As String
Dim sProject As String
Dim sHours As Integer
Dim Msql As String
sActivity = Me.Activity
sDepartment = Me.Department
sProject = Me.Project
sHours = Me.Hour
Mysql = "INSERT INTO TimesheetTable ( Activity, Department, Project, Hour ) SELECT '" & sActivity & "' AS Activity, '" & sDep & "' AS Department, '" & sProject & "' AS Project, " & sHours & " AS Hour"
DoCmd SetWarnings False
DoCmd RunSql Mysql
DoCmd SetWarnings True
Me!TimesheetTableSubform.Form.Requery
End Sub
Compile error - and the DoCmd SetWarnings False is highlighted.
Thanks