Hi,
I am very new to coding in Access. I am trying insert a record to the 'Timelog change history' table when user make changes to 'Timelog' Table.
The 'Timelog Change history' table contain all the same fields as 'Timelog' plus 2 more fields [date Changed] and [TimeStamp].
I am using a Form, in the After-Update event I have the following insert statment and everytime I run it, I keep getting 'Too few parameters. Expected 1'
I 've been stuck for days and trying with a lot of trial and errors with the syntax, and nothing seems to work. Any help is appreciated!!
Thanks in Advance
Private Sub Form_AfterUpdate()
Dim db As Database
Dim logdate As String
Dim Logtime As String
Dim DateTime As String
Set db = CurrentDb
logdate = Format(Date, "dd mmm yyyy")
Logtime = Format(Now(), "Long Time")
DateTime = logdate & " " & Logtime
db.Execute "INSERT INTO [Timelog Changes History] ([TimeStamp])" _
& " SELECT *,[DateTime]As [TimeStamp]" _
& " FROM [Timelog] WHERE [Timelog].[id] =" & Me![id] & ";"
Set db = Nothing
End Sub
I am very new to coding in Access. I am trying insert a record to the 'Timelog change history' table when user make changes to 'Timelog' Table.
The 'Timelog Change history' table contain all the same fields as 'Timelog' plus 2 more fields [date Changed] and [TimeStamp].
I am using a Form, in the After-Update event I have the following insert statment and everytime I run it, I keep getting 'Too few parameters. Expected 1'
I 've been stuck for days and trying with a lot of trial and errors with the syntax, and nothing seems to work. Any help is appreciated!!
Thanks in Advance
Private Sub Form_AfterUpdate()
Dim db As Database
Dim logdate As String
Dim Logtime As String
Dim DateTime As String
Set db = CurrentDb
logdate = Format(Date, "dd mmm yyyy")
Logtime = Format(Now(), "Long Time")
DateTime = logdate & " " & Logtime
db.Execute "INSERT INTO [Timelog Changes History] ([TimeStamp])" _
& " SELECT *,[DateTime]As [TimeStamp]" _
& " FROM [Timelog] WHERE [Timelog].[id] =" & Me![id] & ";"
Set db = Nothing
End Sub