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

Joining three form fields (request.form) to insert into one SQL field 1

Status
Not open for further replies.

timtom

Programmer
Jul 12, 2001
78
0
0
GB
I've got three Select Boxes representing Day, Month and Year and I want them to go into one date field just as if I were inserting the actual date into a field. (i.e. 30/08/01) I know how to split form fields, but not sure how to join them. Any ideas?
Cheers
Sarah
User_timtom.jpg
[sub]WASN'T FIT ENOUGH FOR THE POLICE FORCE[/sub]​
 
Try this, i'm not sure if it is applicable, post your code for more assistance:

dtInsertThisDate = Request.Form("selDay") & _
"/" & Request.Form("selMonth") & _
"/" & Request.Form("selYear")

dtInsertThisDate = Cdate(dtInsertThisDate)


i even got the dd/mm/yyyy in the correct order :)




 
Hi Sarah,

If I follow the question correctly, you can just join the strings together:

E.g.
Code:
myDate = request.form("day") & "/" & request.form("month") & "/" request.form("year")

Just don't forget that VBSCript and Access generally stores the dates in mm/dd/yy format (may not worry you if you're in the US though!)

HTH,

Kevin
 
kevink, Good point about the vbscript default...DO NOT use Cdate with my above solution if you have access set up for dd/mm/yyyy unless your IIS local is set properly also(may have to test).

 
Cheers for the help both of you. Easy when you know how, huh?

Thanks again

Sarah :)
User_timtom.jpg
[sub]WASN'T FIT ENOUGH FOR THE POLICE FORCE[/sub]​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top