Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / November 2004

Tip: Looking for answers? Try searching our database.

Disable criteria of a query based on checkboxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew - 29 Nov 2004 23:50 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.