I have a form with fields that act as user specified criteria for a
form. Two of the fields are start and finish date. The fields in my
query are "ID", "TimeStart", "TimeEnd", etc. Currently, I have the
following:
Between [Forms]![FormName]![Start] And [Forms]![FormName]![Finish]
Currently, the user will specify the start and finish date, and the
query will find data where both TimeStart and TimeEnd fall between
that date. However, I want the user to be able to specify, with a
checkbox maybe, if the start and finish date refers to TimeStart only,
TimeFinish only, or both. Is there a way to disable or enable the
criteria of a query like this??
THanks,
Matt
HJ - 30 Nov 2004 18:03 GMT
I don't know a way to do this in the query itself, but you can program it in
VBA. The code can follow this logic:
If start has been entered, then use the string "TimeStart>=" & Me.Start
If finish has been entered, then ...
If start has been entered, add " AND " to the string.
and append the string with "TimeEnd<=" & Me.Finish
Then you can rewrite the SQL for the query or specify a form filter for your
second form.
There may be better ways, and I do not know all about your situation, but
this is one way to accomplish what you want.
HJ
> I have a form with fields that act as user specified criteria for a
> form. Two of the fields are start and finish date. The fields in my
[quoted text clipped - 13 lines]
>
> Matt