Big scale check-box input logging? (1 Viewer)

cheekybuddha

AWF VIP
Local time
Today, 21:36
Joined
Jul 21, 2014
Messages
2,237
I'm not exactly sure what you're doing here, but see if doing it this way works any better:
Code:
Private Sub btnFinalise_Click()

  With Me
    If .Dirty Then .Dirty = False
    CurrentDb.Execute "UPDATE dbServis SET " & _
                        "SerStatus = '-1', " & _
                        "SerDatum = " & Format(Now, "\#yyyy\-mm\-dd hh:nn:ss\#") & ", " & _
                        "SerFinishedBy = '" & TempVars("UserName") & "' " & _
                      "WHERE  ID LIKE '" & .txtID & "';"
  End With

End Sub

Are ID and SerStatus really Text datatype ???

hth,

d
 

mamradzelvy

Member
Local time
Today, 22:36
Joined
Apr 14, 2020
Messages
145
I'm not exactly sure what you're doing here, but see if doing it this way works any better:
Code:
Private Sub btnFinalise_Click()

  With Me
    If .Dirty Then .Dirty = False
    CurrentDb.Execute "UPDATE dbServis SET " & _
                        "SerStatus = '-1', " & _
                        "SerDatum = " & Format(Now, "\#yyyy\-mm\-dd hh:nn:ss\#") & ", " & _
                        "SerFinishedBy = '" & TempVars("UserName") & "' " & _
                      "WHERE  ID LIKE '" & .txtID & "';"
  End With

End Sub

Are ID and SerStatus really Text datatype ???

hth,

d
Well, no. ID is autonumber but txtID is a textbox and SerStatus is a yes/no field. This Code doesn't result in an error, thank you!
 

cheekybuddha

AWF VIP
Local time
Today, 21:36
Joined
Jul 21, 2014
Messages
2,237
Well, no. ID is autonumber but txtID is a textbox and SerStatus is a yes/no field. This Code doesn't result in an error, thank you!
So, since these are not text datatypes, you don't need to use quotes around their values in the SQL:
Code:
' ...
    CurrentDb.Execute "UPDATE dbServis SET " & _
                        "SerStatus = True, " & _
                        "SerDatum = " & Format(Now, "\#yyyy\-mm\-dd hh:nn:ss\#") & ", " & _
                        "SerFinishedBy = '" & TempVars("UserName") & "' " & _
                      "WHERE  ID LIKE " & .txtID & ";"
' ...

👍

d
 

Users who are viewing this thread

Top Bottom