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

Date of Birth into 1 field

Status
Not open for further replies.

struth

Programmer
Joined
Aug 26, 2001
Messages
114
Location
GB
I want to insert a date of birth from the usual 3 drop boxes into one Access 2000 field (dd/mm/yy). How can this be done?

TIA
 
I didnt make this - todd in the asp forum, but heres the input in blue and the part to insert into database in red. - i've got the input on one page - the insert on another.


<select name=&quot;month&quot; class=&quot;gvff&quot;>
<%
FOR i = 1 to 12
j = &quot; &quot;
IF Month(Now) = i THEN
j = &quot; selected &quot;
END IF
%>
<option<%=j%>value=&quot;<%=i%>&quot;><%=Left(MonthName(i),3)%></option>
<%
NEXT
%>
</select>
<select name=&quot;day&quot; class=&quot;gvff&quot;>
<%
FOR i = 1 to 31
IF i > 3 AND i < 21 THEN
m = Trim(Cstr(i)) & &quot;th&quot;
ELSEIF i > 23 AND i < 31 THEN
m = Trim(Cstr(i)) & &quot;th&quot;
ELSEIF Right(Trim(Cstr(i)),1) = &quot;2&quot; THEN
m = Trim(Cstr(i)) & &quot;nd&quot;
ELSEIF Right(Trim(Cstr(i)),1) = &quot;3&quot; THEN
m = Trim(Cstr(i)) & &quot;rd&quot;
ELSEIF Right(Trim(Cstr(i)),1) = &quot;1&quot; THEN
m = Trim(Cstr(i)) & &quot;st&quot;
END IF
j = &quot; &quot;
IF Day(Now) = i THEN
j = &quot; selected &quot;
END IF
%>
<option<%=j%>value=&quot;<%=i%>&quot;><%=m%></option>
<%
NEXT
%>
</select>
<select name=&quot;year&quot; class=&quot;gvff&quot;>
<%
FOR i = 2000 to 2010
j = &quot; &quot;
IF Year(Now) = i THEN
j = &quot; selected &quot;
END IF
%>
<option<%=j%>value=&quot;<%=i%>&quot;><%=i%></option>
<%
NEXT
%>
</select>

This is the sql to insert - after creating recordset - date part is in red.


strQuery = &quot;INSERT INTO tblScores ([MissionID],[date],[mission],[callsign],[kills],[death],[bomb],[score]) VALUES (&quot; _
& MissionID & Session(&quot;MissionID&quot;) & &quot;, &quot; _
& &quot;#&quot; & Request.Form(&quot;month&quot;) & &quot;/&quot; & Request.Form(&quot;day&quot;) & &quot;/&quot; & Request.Form(&quot;year&quot;) & &quot;#, &quot; _
& &quot;'&quot; & Request.Form(&quot;Mission&quot;) & &quot;', &quot; _
& &quot;'&quot; & callsign & &quot;', &quot; _
& kills & &quot;, &quot; _
& lived & &quot;, &quot; _
& bombed & &quot;, &quot; _
& total & &quot;)&quot;
'Response.Write strQuery & &quot;<br>&quot;
Conn.Execute strQuery &quot;I like a man who grins when he fights.&quot;

-- Prime Minister Winston Churchill

Stuart
 
Thanks, great stuff ... I got to work.

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top