Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp form + access database date/time field

Status
Not open for further replies.

gcapp

IS-IT--Management
Dec 19, 2006
4
US
First time user of this forum and I have a problem.

I have an ASP form that has a field that automatically places the current date into it. It uses the function Date().

The problem I am having is when the form is submitted into my Access database the date is coming out wrong in the Access field. The datatype for the field is Date/Time but it still is not coming out right.

Example: the date in the ASP form shows as 12/19/2006 and the entry in the Access form shows 12:00:27 AM. If I change the format of the Date/Time field to Short Date, the result is: 12/30/1899.

Does anyone know how I can get the data that is posted to the Access database to come out the same as the ASP form??

Any help would be appreciated.
 
Can you show your insert statment? Remember in Access you need to put ## around your date times.
 
Here is my ASP code that inserts that data from the asp form into the database:

<input type="text" name="DateSubmitted" size="15"
value="<%response.write Date() %>"></td>

If Request.Form("posted") = "True" Then
StrDateSubmitted = Request.Form("DateSubmitted") & " "

dlSQL = "INSERT INTO HelpDeskTickets (DateSubmitted)" &_
" VALUES (" & StrDateSubmitted & "')"

Any help would be appreciated
 
It's been awhile since I've used access but I think you need to add #mydate# Pound signs around your dates.

dlSQL = "INSERT INTO HelpDeskTickets (DateSubmitted)" &_
" VALUES (#" & StrDateSubmitted & "#)"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top