A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help running 5 queries with same input criteria



 
 
Thread Tools Display Modes
  #1  
Old October 1st, 2008, 10:24 PM
Lee S. Lee S. is offline
Member
 
First recorded activity by OfficeFrustration: Feb 2005
Posts: 9
Default Help running 5 queries with same input criteria

I have 5 queries that I run every month into which I put a start date and an end date. At the moment, I have to run each query separately & must input the same start date and end date in each. I put them into a macro, but it still prompts me for the start date and end date of each. Is there a way that I can input the start date and end date only once & have it pass through as the criteria for all five queries?

Thanks,

Lee
  #2  
Old October 1st, 2008, 11:42 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Help running 5 queries with same input criteria

Use an unbound form with textboxes to enter the dates. Refer the to
textboxes in the queries.
Remember the form must be open with data in the boxes.
--
KARL DEWEY
Build a little - Test a little


"Lee S." wrote:


I have 5 queries that I run every month into which I put a start date
and an end date. At the moment, I have to run each query separately &
must input the same start date and end date in each. I put them into a
macro, but it still prompts me for the start date and end date of each.
Is there a way that I can input the start date and end date only once &
have it pass through as the criteria for all five queries?

Thanks,

Lee




--
Lee S.

  #3  
Old October 2nd, 2008, 12:42 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Help running 5 queries with same input criteria

On Wed, 1 Oct 2008 22:24:40 +0100, Lee S.
wrote:


I have 5 queries that I run every month into which I put a start date
and an end date. At the moment, I have to run each query separately &
must input the same start date and end date in each. I put them into a
macro, but it still prompts me for the start date and end date of each.
Is there a way that I can input the start date and end date only once &
have it pass through as the criteria for all five queries?

Thanks,

Lee


A couple of ways. One would be to create a little unbound form, frmCrit, with
two textboxes txtStart and txtEnd. In your queries use a criterion such as

BETWEEN [Forms]![frmCrit]![txtStart] AND [Forms]![frmCrit]![txtEnd]

Put a command button on the form to run a Macro or VBA code which executes all
five queries.

Or, if the queries always are for (say) the previous month from the time that
the query is executed, just put in the date directly:

= DateSerial(Year(Date()), Month(Date()) - 1, 1) AND DateSerial(Year(Date()), Month(Date()), 1)


or adapt as needed.
--

John W. Vinson [MVP]
  #4  
Old October 3rd, 2008, 03:19 AM
Lee S. Lee S. is offline
Member
 
First recorded activity by OfficeFrustration: Feb 2005
Posts: 9
Default

Quote:
Originally Posted by John W. Vinson View Post
On Wed, 1 Oct 2008 22:24:40 +0100, Lee S.
wrote:


I have 5 queries that I run every month into which I put a start date
and an end date. At the moment, I have to run each query separately &
must input the same start date and end date in each. I put them into a
macro, but it still prompts me for the start date and end date of each.
Is there a way that I can input the start date and end date only once &
have it pass through as the criteria for all five queries?

Thanks,

Lee


A couple of ways. One would be to create a little unbound form, frmCrit, with
two textboxes txtStart and txtEnd. In your queries use a criterion such as

BETWEEN [Forms]![frmCrit]![txtStart] AND [Forms]![frmCrit]![txtEnd]

Put a command button on the form to run a Macro or VBA code which executes all
five queries.

Or, if the queries always are for (say) the previous month from the time that
the query is executed, just put in the date directly:

= DateSerial(Year(Date()), Month(Date()) - 1, 1) AND DateSerial(Year(Date()), Month(Date()), 1)


or adapt as needed.
--

John W. Vinson [MVP]
That worked just as slick as can be. (Made me look good with the boss!)

A thousand thanks!!
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.