Kind of - the whole bit of code which inserts the form data to the subform table works fine - which is below:
Code:
Private Sub AddToSheet_Click()
Dim sActivity As String
Dim sProject As String
Dim sHours As Double
sDescript = Nz(Me.Description, " ")
Me.Description = sDescript
Dim Mysql As String
Dim sLogUser As String
Dim sDate As Date
Dim sCostCode As String
If Me.Activity = "" Then
MsgBox "You must enter activity before continuing", vbInformation
Me.Activity.SetFocus
Exit Sub
End If
If Me.Project = "" Then
MsgBox "You must enter a Project before continuing", vbInformation
Me.Project.SetFocus
Exit Sub
End If
If Me.LoggedInUser = "" Then
MsgBox "You must enter activity before continuing", vbInformation
Me.LoggedInUser.SetFocus
Exit Sub
End If
sCostCode = Me.CostCode
sActivity = Me.Activity.Column(0)
sProject = Me.Project
sHours = Nz(Me.Hour, 0)
sDescript = Nz(Me.Description, " ")
Me.Description = sDescript
sLogUser = Me.LoggedInUser
sDate = Me.DatePicker
Mysql = "INSERT INTO TimesheetTableTemp (sCostCOde, Activity, Project, Hours, Description, suser, [task date]) Values "
Mysql = Mysql & "('" & sCostCode & "', '" & sActivity & "', '" & sProject & "', " & sHours & ", '" & sDescript & "', '" & sLogUser & "', '" + Format(sDate) + "')"
DoCmd.SetWarnings False
DoCmd.RunSQL Mysql
DoCmd.SetWarnings True
Me!TimesheetTableSubform.Form.Requery
ClearField
End Sub
The part that doesnt work (unless there is text in the description) is the code below:
Code:
Private Sub submit_Click()
Dim strSQL, strSQLDelete As String
DoCmd.SetWarnings False
strSQL = "INSERT INTO TimesheetTable SELECT * FROM TimesheetTableTemp;"
strSQLDelete = "DELETE * FROM TimesheetTableTemp;"
DoCmd.RunSQL (strSQL)
DoEvents
DoCmd.RunSQL (strSQLDelete)
DoCmd.SetWarnings True
End Sub
Appreciate your help on this one