We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How do I insert the current date into Access?

QLJ
QLJ asked
on
Medium Priority
694 Views
Last Modified: 2008-02-01
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
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2012

Commented:
Make Now() the default for that column.
QLJ

Author

Commented:
sqlStr = "Insert into Feedback(FirstName,LastName,Designation,CompanyName,Position,Email,Contact,Feedback,SysDate,SysTime) & 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...
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Try this:

sqlStr = "Insert into Feedback(FirstName,LastName,Designation,CompanyName,Position,Email,Contact,Feedback,SysDate,SysTime) & Values ('" & request("firstname") & "', '" & request("lastname") & "', '" & request("radiobutton") & "', '" & request("company") & "', '" & request("position") & "','" & request("email") & "','" & request("number") & "','" & request("feedback") & ", Date(), Time()')"
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
>>In my database, the field should be of type date/time or what?
Yes, exactly.
QLJ

Author

Commented:
hmm.. this doesnt solve the problem. The SysDate and SysTime field remains empty in the database
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
QLJ

Author

Commented:
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!
CERTIFIED EXPERT
Top Expert 2012
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Now more clear, QLJ ?
QLJ

Author

Commented:
hey.. thanx guys! it worked! I'm a happy person! :)
sorry acperkins, din really get what you meant initially. :)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.