QLJ
asked on
How do I insert the current date into Access?
Hi,
I have this form online and I want to be able to write the date and time of submission into this access database that I have. How do i do it?
In my database, the field should be of type date/time or what?
Thanx
I have this form online and I want to be able to write the date and time of submission into this access database that I have. How do i do it?
In my database, the field should be of type date/time or what?
Thanx
Make Now() the default for that column.
ASKER
sqlStr = "Insert into Feedback(FirstName,LastNam e,Designat ion,Compan yName,Posi tion,Email ,Contact,F eedback,Sy sDate,SysT ime) & Values ('" & request("firstname") & "', '" & request("lastname") & "', '" & request("radiobutton") & "', '" & request("company") & "', '" & request("position") & "','" & request("email") & "','" & request("number") & "','" & request("feedback") & "')"
say I want to enter the date and time into the db(SysDate, SysTime), what should I do?
the now()works fine if I just want to display, but when I try to insert, nothing is inserted. I was wondering what might have gone wrong...
say I want to enter the date and time into the db(SysDate, SysTime), what should I do?
the now()works fine if I just want to display, but when I try to insert, nothing is inserted. I was wondering what might have gone wrong...
Try this:
sqlStr = "Insert into Feedback(FirstName,LastNam e,Designat ion,Compan yName,Posi tion,Email ,Contact,F eedback,Sy sDate,SysT ime) & Values ('" & request("firstname") & "', '" & request("lastname") & "', '" & request("radiobutton") & "', '" & request("company") & "', '" & request("position") & "','" & request("email") & "','" & request("number") & "','" & request("feedback") & ", Date(), Time()')"
sqlStr = "Insert into Feedback(FirstName,LastNam
>>In my database, the field should be of type date/time or what?
Yes, exactly.
Yes, exactly.
ASKER
hmm.. this doesnt solve the problem. The SysDate and SysTime field remains empty in the database
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oh no.. your first method doesnt work
>>Go to the Table Design Window, select the Feedback table, select the file SysDate, set it's Default Property to =Date(), >>and then select the SysTime field, set it's Default Property to =Time()
Which field do you mean? in the Format field of the Field Properties?
ps. Thanx for the effort! (even though it is of measly points) Decided to up it to make it up to you!
>>Go to the Table Design Window, select the Feedback table, select the file SysDate, set it's Default Property to =Date(), >>and then select the SysTime field, set it's Default Property to =Time()
Which field do you mean? in the Format field of the Field Properties?
ps. Thanx for the effort! (even though it is of measly points) Decided to up it to make it up to you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Now more clear, QLJ ?
ASKER
hey.. thanx guys! it worked! I'm a happy person! :)
sorry acperkins, din really get what you meant initially. :)
sorry acperkins, din really get what you meant initially. :)