PDA

Click to See Complete Forum and Search --> : can any one help me with this query


pavan_kumard
Nov 9th, 2000, 10:23 PM
i have a table named orders in MS Access database.This table has a column named dateofcreation.I want to extract data available in the table between two dates.These two dates are available in two text boxes say text1 and text2.The dates are entered in two the textboxes in the format dd/mm/yy.How can I write a query in such a way that i can extract data available in the table between these two dates.The database is MS ACCESS.
Can any one help me out.
Thank you.
Pavan.D

marex
Nov 10th, 2000, 03:25 AM
[B]Try This[/]


I set a date of 01/01/80 into the dateofcreation when its empty with the IIF command.

code

dbs.Execute "SELECT * FROM table" _
& "WHERE " _
&"IIF(ISNULL(table.dateofcreation),'#01/01/80#',table.dateofcreation) " _
& "BETWEEN DateValue(' " & Text1 & " ') AND " _
& "DateValue(' " & Text2 & " ') " , dbFailOnError


Cheers
Ray