Multiple Sql Syntax

burrina

Registered User.
Local time
Today, 16:23
Joined
May 10, 2014
Messages
972
Having a Gump moment again! I need to add the line of code that says SickDay to the first line of sql so that it ONLY adds the current record.


PHP:
'UPDATE PAYROLL DATA
    DoCmd.Hourglass True
    DoCmd.SetWarnings False

    DoCmd.RunSQL "UPDATE tblHour SET tblHour.WorkDate = Me.AbsenceDte " & _
                 "WHERE (((tblHour.EmployeeID)='" & Me.EmployeeID.Value & "'));"
    DoCmd.RunSQL "UPDATE tblHour SET tblHour.SickDay = True "
    
    DoCmd.SetWarnings True
    DoCmd.Hourglass False
 
I'm not sure I'm following what you want to do. Here's my best guess. I'm assumiing EmployeeId is numeric datatype.
I would recommend the db.execute syntax also.

(untested)
Code:
Dim SSql as string
SSql = "UPDATE tblHour"   _
         & " SET tblHour.WorkDate =#" & Me.AbsenceDte & "#, tblHour.SickDay = True " _
         & " WHERE tblHour.EmployeeID= " & Me.EmployeeID 

'for debugging --see the result of  Access' rendering of the form values --uncomment the next line
'Debug.print SSql
CurrentDB.Execute SSql,dbFailOnError

SQL Update syntax
 
Last edited:
I get this error?
 

Attachments

  • sqlerror.jpg
    sqlerror.jpg
    23.2 KB · Views: 96
I have removed the () and updated the post, try again.
 

Users who are viewing this thread

Back
Top Bottom