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 / Forms Programming / May 2007

Tip: Looking for answers? Try searching our database.

Command button - Trigger one of Two Macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vinny P - 11 May 2007 18:46 GMT
Sorry for the bad Subject. Hopefully I can better explain my issue here. I
have ONE command button to launch a query. But depending on the time of month
and which month we are in will determine which query is ran. For example, the
date is today, 5/11/07, the query will retrieve all records for the past 3
months including current month, May April and March. Come June 1st thru June
7th, I want the query to retrieve May, April and March but after June 7th,
June, May and April. the queries are built, I am looking to create one
command button so there is no confusion to the user. The process should be
transparent to the user. Hope this makes sense.
Damon Heron - 11 May 2007 20:43 GMT
If I understand you right, there are two queries (or more?) that are
retrieve records for various periods. One query retrieves records for the
three months, MarAprMay, and the second AprMayJune.  If that is the case???,
then in the click event:

If Date > #5/10/2007# And Date < #6/7/2007# Then
DoCmd.OpenQuery "query1"
Else
DoCmd.OpenQuery "query2"
End If

However,  what happens after those periods? do u have queries for all the
months of the year?  If so, then you might want to use Select Case instead
of a series of if then statements.

HTH
Damon

> Sorry for the bad Subject. Hopefully I can better explain my issue here. I
> have ONE command button to launch a query. But depending on the time of
[quoted text clipped - 8 lines]
> command button so there is no confusion to the user. The process should be
> transparent to the user. Hope this makes sense.
 
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.