By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Disable criteria of a query based on checkboxes

P: n/a
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
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
HJ
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

"Matthew" <ma************@eaton.com> wrote in message
news:7f**************************@posting.google.c om...
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

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.