View Full Version : Date Field
npala2001
04-19-2005, 04:26 AM
Currently, I have a textbox field within a html form that lets users manually type in the date. This has caused me problems. So in order to solve the problem myself I have created three drop down box fields to collect date information within a HTML form:
They are as follows:
M = Month, D = Date, and Y = Year
Now each of these three fields need to be inserted into one field in a database, but I am not sure exactly how to accomplish this.
Am I taking the wrong approach to this?
Any help would be greatly appreciated.
glenngv
04-19-2005, 04:46 AM
You would just retrieve the selected item as you normally do with other fields using Request.Form or Request.QueryString collections and then join them together to form the date.
npala2001
04-19-2005, 05:33 AM
Thanks for the fast response. I know that you request the data from the form using request.form , but how do I get (M, D, Y) into just one field in a table. I am probably just not seeing it yet. Below is what I have so far. Thanks again glenn for your help. :)
<%
dim M
dim D
dim Y
M=request.form("M")
D=request.form("D")
Y=request.form("Y")
p=Server.MapPath("rcqr.mdb")
set con= Server.CreateObject("ADODB.Connection")
con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; dbq=" & p
sql = "insert into tblQR (onefield) values ('"& onefield &"')"
set rs = con.execute(sql)
con.close
set con = nothing
'response.end
%>
glenngv
04-19-2005, 07:08 AM
... and then join them together to form the date.
onefield = M & "/" & D & "/" & Y
I think Access uses # and not ' as date delimiter.
sql = "insert into tblQR (onefield) values (#"& onefield &"#)"
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.