I am trying to integrate into my form a audit table showing how long a person takes to work a record. I get a missing operator error on the insert into statements. When I debug it the StartTime is showing as 12 AM and has no date associated with it. Any ideas why this is not being assigned with the StartTime = Now()? Thanks.





Option Compare DatabasePublic StartTime As Date
Public EndTime As Date






Private Sub Form_Load()


Dim User As String
Dim MyLogIn As String
Dim Task As String
Dim StartTime As Date
Dim EndTime As Date




User = Environ("UserName")


MyLogIn = DLookup("Username", "tblUser", "UserLogin = '" & User & "'")


Task = "Select * from tblAff_Needing_Review Where [QA/QC Analyst] = '" & MyLogIn & "'"




Me.RecordSource = Task




StartTime = Now()










End Sub
Private Sub NextRecord_Click()


If Me.CurrentRecord < Me.Recordset.RecordCount Then
EndTime = Now()
DoCmd.RunSQL "INSERT INTO Aff_Audit (RecordNumber,StartTime,EndTime )VALUES (" & Me.ID & ", " & StartTime & ", " & EndTime & ");"
DoCmd.GoToRecord , , acNext
StartTime = Now()
End If
End Sub






Private Sub Form_Close()
EndTime = Now()
DoCmd.RunSQL "INSERT INTO Aff_Audit (RecordNumber,StartTime,EndTime )VALUES (" & Me.ID & ", " & StartTime & ", " & EndTime & ");"
End Sub