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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Type MisMatch Error - help!!!!! 1

Status
Not open for further replies.

WB786

MIS
Mar 14, 2002
610
ok I know how to use the cdate to covert date to be written into a date/time field in Access db but how do you the same for the following:

oRS.Fields("EventDate") = request.form("date_month") & request.form("date_day") & request.form("date_year")

I have three drop downs on the form page for month, day, and year. But they need to go in as mm/dd/yyyy in Access.

Thanks in advance,


:)WB
 
oRS.Fields("EventDate") = request.form("date_month") & [!] "/" & [/!]request.form("date_day") & [!] "/" & [/!]request.form("date_year")

Because there can be some ambiguity with the Month/day/year format vs. day/month/year, you're probably better off with...

oRS.Fields("EventDate") = request.form("[!]date_year[/!]") & "-" & request.form("[!]date_month[/!]") & "-" & request.form("[!]date_day[/!]")


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George,

I am not going to have any problems with month/day orientation as the user has to choose the day and month from a drop down.

Your soultion works either way. But will use the second one you have listed.

Thanks all,

:)WB
 
WB786

It's not the ASP script that I am concerned about. It's the database. Depending on the regional settings, dates can be interpreted different. Ex. 2/4/2006 is this Feb 4th or Apr 2nd. The database must decide, which is no good for you. You want to control your dates. By listing the date as '2006-02-04' this will ALWAYS be interpreted as feb 4th. There is nothing for the database to decide and no ambiguity.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
You are so right. I was so hung up on trying to get the script going didn't even think how that would translate on the db end. I guess: Never be tried and program at the same time!

Thanks,

:)WB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top