Edit: I fixed it. The problem is the field name Timestamp, it's a Reserved word. So I changed it to [Timestamp] and now it works.
Hi,
I'm using a Access database.
In this database I've a table called VisitReport.
In the table VisitReport there is a field Timestamp from the type Date/Time -> "General Date"
Now what I want to do is save the current time towards the Timestamp field.
I tried to use this in the querry:
Timestamp=" & Now & " or #" & Now & "#
and even this:
Timestamp=#" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & "#
But they return syntax errors.
I haven't worked with general date or the Now function before so please explain to me how to do this thing.
Thanks a lot.
Used code:
VB Code:
sqlCreateVisitReport = "INSERT INTO VisitReport (VisitDate, CompanyName,WrittenBy,Address,VisitedBy,DFIStakeholders,ExecutiveSummary ,AgreedBusinessObjective,VisitReportFile,Presentation ,Timestamp) VALUES (#" & Year(vrdate) & "-" & Month(vrdate) & "-" & Day(vrdate) & "#,'" & accountname & "','" & writtenby & "','" & address & "','" & visitedby & "','" & dfistakeholders & "', '" & executivesummary & "','" & agreedbusinessobjective & "','" & visitreport & "','" & presentation & "', " & Now & ")"




Reply With Quote