I am trying to amend my sql statement to include another field with no success, my sql skills are just about nil so hopefully someone else may be able to throw a little light on how to. Heres what I have originally and I have commented out the sql field that I need to add to the sql statement as it doesn't work and throws a syntax error when uncommented
The working sql from Debug.Print strSql gives
Many thanks for reading Gerry from Australia
Code:
[FONT=Times New Roman][FONT=Times New Roman][SIZE=3] strSql = "UPDATE Attend SET"
[/SIZE][/FONT][SIZE=3][FONT=Times New Roman]strSql = strSql & " Attend.AttType = " & TypeAttend & ","
strSql = strSql & " Attend.LoggedOnUser = '" & Me![txtUserId] & "',"
strSql = strSql & " Attend.LastAmendedDate = #" & Now() & "#"[/FONT][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][FONT=Times New Roman]''''strSql = strSql & " PrevVal_TypeAttend = " & PrevVal_TypeAttend & ""
strSql = strSql & " WHERE Attend.AttStudent = " & Me![scrStudent] & " AND"
strSql = strSql & " Attend.AttDate = #" & TDate & "#;"
' amended/added below on
' ..21 Jan 2018 G.McGinty
'strSql = strSql & " PrevVal_TypeAttend = " & PrevVal_TypeAttend & ""
End If[/FONT][/SIZE][/FONT]
Code:
[FONT=Times New Roman][SIZE=3][FONT=Times New Roman]'UPDATE Attend SET Attend.AttType = 2, Attend.LoggedOnUser = 'gerry', Attend.LastAmendedDate = #21/01/2018 4:26:11 PM# WHERE Attend.AttStudent = 219477 AND Attend.AttDate = #21/01/2018#;[/FONT][/SIZE][/FONT]
[FONT=Times New Roman][FONT=Times New Roman][SIZE=3]DoCmd.RunSQL strSql[/SIZE][/FONT][/FONT]