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

search DB with date

Status
Not open for further replies.

pikasat

Technical User
Jun 7, 2002
12
HR
Hi to all. This q is probably sily for most of you, but for me...
How to convert numbes from 3 dropdown lists into a date ? On a page there are a 3 dropdown lists where user can select day, month and year.
Then it should search a database is the date (entered in the dropdown's) greater/smaller/etc. from the date in the database. How to do this ?
Thank you
 
Read faq222-2244 to see how to ask questions that get the best answers, and how to do basic research.

For this question, if you are using VBScript, try the DateSerial function:

Then go to FAQ section of this forum, where there are several FAQs regarding getting data from databases. If you then have specific questions then come back with the code you're having a problem with.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
step 1:
you have to concatenate the selected values from the dropdown lists...something like this

dim mydate
mydate=request.form("monthval")&"/"&request.form("dayval")&"/"request.form("yearval")

step 2: then you can compare mydate with the datefield in your database

Select * from mytable where datefield > mydate

or something similar...

there will be some type mismatch issues...you have to make sure to use cast or convert function in your query depending on the data type of your datefield in the database...


-DNG
 
Isn't that what Dateserial does?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top