Hello All,
I have this code below. I am trying to figure out where to put the "dbSeeChanges" portion of it so it will update my SQL db. I have tried different places in the code and I get type mismatch, which I understand.
Any Ideas?
Thanks
I have this code below. I am trying to figure out where to put the "dbSeeChanges" portion of it so it will update my SQL db. I have tried different places in the code and I get type mismatch, which I understand.
Any Ideas?
Thanks
Code:
Private Sub Form_AfterUpdate()
Dim dd As Date
Dim dbs As DAO.Database
Set dbs = CurrentDb
Dim pID As Integer
Dim sHostName As String
Dim sUserName As String
Dim cmd As String
pID = [productid].Value
dd = Format(Now(), "dd/mm/yyyy hh:mm:ss")
' Get Host Name / Get Computer Name
sHostName = Environ("computername")
' Get Current User Name
sUserName = Environ("username") 'Username is obtained to produce Time and UserStamp
cmd = "UPDATE Product SET DateStamp=#" & dd & "#, UserStamp='" & sUserName & "' WHERE [productID]=" & pID & ""
dbs.Execute cmd
End Sub