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

how do you search for dates?

Status
Not open for further replies.

AxeaXeaxE

Programmer
Apr 22, 2002
21
NL
I have 3 lists of values, containing day, month and year. There are 3 possiblities: choose day and month and year, choose month and year or choose nothing. How do I search in a table for the records? I put them in "Keuzelijst"

I've got this, but it doesn't work properly:

If ChcDay.Value <> &quot;&quot; Then
day = KzeDag.Value & &quot;-&quot;
Else: day = &quot;&quot;
End If

month = ChcMonth.Value & &quot;-&quot;

year = ChcYear.Value

date = day & month & year

Keuzelijst.RowSource = &quot;select export2.id, export2.chauffeur, export2.kenteken, export2.schadenummer, export2.schadedatum, export2.klantnummer from export2 where &quot; & date & &quot; is export2.schadedatum&quot;

 
Hi,

I think that you want your Where Clause to state...
Code:
&quot;where  export2.schadedatum = &quot; & date & &quot; &quot;
:) Skip,
metzgsk@voughtaircraft.com
 
No, that's not quite what I mean. I want him to search for everything containing 04-2002 when a user only filled in month and year. That's the tricky part...
 
I thnk that in that case you'll need to build a Where Statement like this...
Code:
Where export2.schadedatum Between &quot; & FromDate & &quot; And &quot; & ThruDate
where in your example, the FromDate is 01-04-2002 and ThruDate is 30-04-2002. Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top