Update Query (1 Viewer)

Juniour

New member
Local time
Today, 18:44
Joined
Mar 3, 2020
Messages
23
Good day,
I know this topic has probably been discussed many times but I am struggling to find the approriate information. Could someone please show mhere I am going wrong with this Update query?

Your help would be greatly appreciated.
 

Attachments

  • Capture.PNG
    Capture.PNG
    21.3 KB · Views: 89

Ranman256

Well-known member
Local time
Today, 12:44
Joined
Apr 9, 2015
Messages
4,339
too many SET commands. (only 1 needed per query)
dont use sql code, use queries. they never get syntax wrong.
 

Juniour

New member
Local time
Today, 18:44
Joined
Mar 3, 2020
Messages
23
Thank you so much for your response,
I agree with you on the query statement it works better for me.
Unfortunately the code was writen before me and it works without my addition. Now I want to add fields to the table.
Could you assist with adding my 2 new fields to the existing code?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:44
Joined
May 7, 2009
Messages
19,169
Code:
strSQL = "Update TimeLog " & _
    "SET TimeEnd = #" & Format(Me!txtTime, "hh:nn:ss") & "#, " & _
    "Type_Of_Duty = '" & Forms!frmTimeClock!Combo508 & "', " & _
    "Flight_Time = #" & Format(Forms!frmTimeClock!Flight!Flight_Time, "hh:nn:ss") & "# " & _
    "WHERE EmployeeID = " & Forms!frmLogin!cboEmployee & " " & _
    "AND TimeEnd Is Null;"
 

Juniour

New member
Local time
Today, 18:44
Joined
Mar 3, 2020
Messages
23
AWESOME!!!!!! Your Amaizing. Thanks!!
I removed the Higlighted below to make it work.
Seems like I have a lot still to learn about syntaxes.

strSQL = "Update TimeLog " & _
"SET TimeEnd = #" & Format(Me!txtTime, "hh:nn:ss") & "#, " & _
"Type_Of_Duty = '" & Forms!frmTimeClock!Combo508 & "', " & _
"Flight_Time = #" & Format(Forms!frmTimeClock!Flight!Flight_Time, "hh:nn:ss") & "# " & _
"WHERE EmployeeID = " & Forms!frmLogin!cboEmployee & " " & _
"AND TimeEnd Is Null;"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:44
Joined
May 7, 2009
Messages
19,169
you're welcom. i agree you need to read more on how to Concatenate between strings, date, time, number.
 

Users who are viewing this thread

Top Bottom