If I understood you then you want to update the field Time where the field
SSN = the field newSSN in the form.
Using VBA
Docmd.RunSql "UPDATE Main SET Main.[Time] = Now() WHERE Main.SSN = " &
Forms![FormName]![newSSN]
' incase SSN is number type
============================================
Docmd.RunSql "UPDATE Main SET Main.[Time] = Now() WHERE Main.SSN = '" &
Forms![FormName]![newSSN] & "'"
' incase SSN is string type
============================================
The SQL you gave will update all the fields in the table, and I'm not sure
if that what you want to do, but if that what you are trying to do, then
' If SSN string
Docmd.RunSql "UPDATE Main SET Main.SSN = '" & Forms![FormName]![newSSN] &
"', Main.[Time] = Now()"
' If SSN Number
Docmd.RunSql "UPDATE Main SET Main.SSN = " & Forms![FormName]![newSSN] & ",
Main.[Time] = Now()"
pokdbz said:
I need to update a field called Time for a SSN.
Here is the query that I have:
UPDATE Main SET Main.SSN = [newSSN], Main.[Time] = Now();
Does that look right?
But how do I update it using code? SSN is a text box on the form.