UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Syntax, Access 2016    
 
   
mike60smart
post Feb 14 2020, 04:16 PM
Post#1


UtterAccess VIP
Posts: 13,923
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I am getting the following error when I try to run the following On Click Event.

Attached File  error.PNG ( 4.97K )Number of downloads: 2


CODE
Private Sub cmdUpdateCourse_Click()

10        On Error GoTo cmdUpdateCourse_Click_Error

          Dim dtCourseDate As Date
20        dtCourseDate = Me.dtCourseDate
      Dim strSQL As String
30    strSQL = "UPDATE jtblPositionTraining SET CourseDate = " & Me.dtCourseDate & " WHERE EmployeeNr = " & Me.EmpNr & " AND TrainingDetails = " & Me.txtCourse & ";"
40    Debug.Print strSQL
50    CurrentDb.Execute strSQL, dbFailOnError

55      MsgBox "AllDates Updated", vbInformation
60        On Error GoTo 0
70        Exit Sub

cmdUpdateCourse_Click_Error:

80        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdUpdateCourse_Click, line " & Erl & "."

End Sub


The Immediate windows displays the following correct values:-

UPDATE jtblPositionTraining SET CourseDate = 14/02/2020 WHERE EmployeeNr = 81768 AND TrainingDetails = Knife Safety;

Can anyone point out where I am going wrong?

Any help appreciated.


--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 

Posts in this topic



Custom Search


RSSSearch   Top   Lo-Fi    1st June 2020 - 11:17 PM