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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

criteria



 
 
Thread Tools Display Modes
  #1  
Old February 24th, 2009, 09:34 PM posted to microsoft.public.access.tablesdbdesign
Christina
external usenet poster
 
Posts: 282
Default criteria

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks

  #2  
Old February 25th, 2009, 12:13 AM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default criteria

On Tue, 24 Feb 2009 13:34:01 -0800, Christina wrote:

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks


You will need a form for this.
Create a form. Add 2 unbound text controls.
Set their format property to a valid date format.
Name one control "StartDate'.
Name the other control "EndDate".
Add a command button to the form.
Code it's click event:

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

Name this form "ParamForm".

As criteria for the main report query, and also for the sub-report
query, enter, on the Date field's criteria line:
Between Forms!ParamForm!StartDate and Forms!ParamForm!EndDate

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Then when you are ready to run the report, open the form.
Enter the starting and ending dates wanted.
Click the command button.
The report and it's sub report will run.
When the report closes, it will also close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old February 25th, 2009, 03:51 AM posted to microsoft.public.access.tablesdbdesign
Christina
external usenet poster
 
Posts: 282
Default criteria

Thanks you. I am not sure how to add the code to the click event or code
the main report close event. Please for detail instructions.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 13:34:01 -0800, Christina wrote:

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks


You will need a form for this.
Create a form. Add 2 unbound text controls.
Set their format property to a valid date format.
Name one control "StartDate'.
Name the other control "EndDate".
Add a command button to the form.
Code it's click event:

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

Name this form "ParamForm".

As criteria for the main report query, and also for the sub-report
query, enter, on the Date field's criteria line:
Between Forms!ParamForm!StartDate and Forms!ParamForm!EndDate

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Then when you are ready to run the report, open the form.
Enter the starting and ending dates wanted.
Click the command button.
The report and it's sub report will run.
When the report closes, it will also close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #4  
Old February 25th, 2009, 05:20 AM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default criteria

On Tue, 24 Feb 2009 19:51:01 -0800, Christina wrote:

Thanks you. I am not sure how to add the code to the click event or code
the main report close event. Please for detail instructions.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 13:34:01 -0800, Christina wrote:

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks


You will need a form for this.
Create a form. Add 2 unbound text controls.
Set their format property to a valid date format.
Name one control "StartDate'.
Name the other control "EndDate".
Add a command button to the form.
Code it's click event:

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

Name this form "ParamForm".

As criteria for the main report query, and also for the sub-report
query, enter, on the Date field's criteria line:
Between Forms!ParamForm!StartDate and Forms!ParamForm!EndDate

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Then when you are ready to run the report, open the form.
Enter the starting and ending dates wanted.
Click the command button.
The report and it's sub report will run.
When the report closes, it will also close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail



For the Form, select the Command Button.
Display the button's property sheet.
Click on the Event tab.
Click on the event line you wish to code, i.e. the Click event.
Write
[Event Procedure]
on that line.
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those lines write your code for the command button.

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

For the Report, display the Report's property sheet.
Click on the Close evnet line and follow the same instructions as for
the Form Command button.
Write the code:

DoCmd.Close acForm, "ParamForm"
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #5  
Old February 25th, 2009, 07:50 PM posted to microsoft.public.access.tablesdbdesign
Christina
external usenet poster
 
Posts: 282
Default criteria

Small question. WHen I am create the command button, do I follow all the
instructions and link the report to the button? Otherwise I need to know what
to do when I create the button so that I can put the code. Hope you
understand my question.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 19:51:01 -0800, Christina wrote:

Thanks you. I am not sure how to add the code to the click event or code
the main report close event. Please for detail instructions.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 13:34:01 -0800, Christina wrote:

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks

You will need a form for this.
Create a form. Add 2 unbound text controls.
Set their format property to a valid date format.
Name one control "StartDate'.
Name the other control "EndDate".
Add a command button to the form.
Code it's click event:

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

Name this form "ParamForm".

As criteria for the main report query, and also for the sub-report
query, enter, on the Date field's criteria line:
Between Forms!ParamForm!StartDate and Forms!ParamForm!EndDate

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Then when you are ready to run the report, open the form.
Enter the starting and ending dates wanted.
Click the command button.
The report and it's sub report will run.
When the report closes, it will also close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail



For the Form, select the Command Button.
Display the button's property sheet.
Click on the Event tab.
Click on the event line you wish to code, i.e. the Click event.
Write
[Event Procedure]
on that line.
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those lines write your code for the command button.

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

For the Report, display the Report's property sheet.
Click on the Close evnet line and follow the same instructions as for
the Form Command button.
Write the code:

DoCmd.Close acForm, "ParamForm"
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #6  
Old February 25th, 2009, 10:32 PM posted to microsoft.public.access.tablesdbdesign
Christina
external usenet poster
 
Posts: 282
Default criteria

Hi, The report does not return any data. I created the form with the two
text Boxes as instructed. I added a command button with this code in the
click event.
Private Sub Command21_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
There were some other code in there before the End Sub. Should I delete
that? I tried it both ways anyhow, and it did not run. Don't know what I am
doing wrong.

Christina" wrote:

Small question. WHen I am create the command button, do I follow all the
instructions and link the report to the button? Otherwise I need to know what
to do when I create the button so that I can put the code. Hope you
understand my question.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 19:51:01 -0800, Christina wrote:

Thanks you. I am not sure how to add the code to the click event or code
the main report close event. Please for detail instructions.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 13:34:01 -0800, Christina wrote:

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks

You will need a form for this.
Create a form. Add 2 unbound text controls.
Set their format property to a valid date format.
Name one control "StartDate'.
Name the other control "EndDate".
Add a command button to the form.
Code it's click event:

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

Name this form "ParamForm".

As criteria for the main report query, and also for the sub-report
query, enter, on the Date field's criteria line:
Between Forms!ParamForm!StartDate and Forms!ParamForm!EndDate

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Then when you are ready to run the report, open the form.
Enter the starting and ending dates wanted.
Click the command button.
The report and it's sub report will run.
When the report closes, it will also close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail



For the Form, select the Command Button.
Display the button's property sheet.
Click on the Event tab.
Click on the event line you wish to code, i.e. the Click event.
Write
[Event Procedure]
on that line.
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those lines write your code for the command button.

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

For the Report, display the Report's property sheet.
Click on the Close evnet line and follow the same instructions as for
the Form Command button.
Write the code:

DoCmd.Close acForm, "ParamForm"
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #7  
Old February 26th, 2009, 01:22 AM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default criteria

On Wed, 25 Feb 2009 14:32:01 -0800, Christina wrote:

Hi, The report does not return any data. I created the form with the two
text Boxes as instructed. I added a command button with this code in the
click event.
Private Sub Command21_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
There were some other code in there before the End Sub. Should I delete
that? I tried it both ways anyhow, and it did not run. Don't know what I am
doing wrong.

Christina" wrote:

Small question. WHen I am create the command button, do I follow all the
instructions and link the report to the button? Otherwise I need to know what
to do when I create the button so that I can put the code. Hope you
understand my question.

Thanks

*** snipped ***

I don't know what you are doing wrong either, as I am here and you are
there. :-(

Don't use the Wizard when you know the code you wish to use.
So yes, delete any other code in that command button's click event.
The complete code (in that event) should look like this:

Private Sub Command12_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
End Sub

The same goes for the Report Close event. Don't use the Command Button
wizard.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #8  
Old February 26th, 2009, 04:56 PM posted to microsoft.public.access.tablesdbdesign
Christina
external usenet poster
 
Posts: 282
Default criteria

Thanks again. Problem, the only way I k now to create a command button is
with the wizard . Can you please walk me through.

"fredg" wrote:

On Wed, 25 Feb 2009 14:32:01 -0800, Christina wrote:

Hi, The report does not return any data. I created the form with the two
text Boxes as instructed. I added a command button with this code in the
click event.
Private Sub Command21_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
There were some other code in there before the End Sub. Should I delete
that? I tried it both ways anyhow, and it did not run. Don't know what I am
doing wrong.

Christina" wrote:

Small question. WHen I am create the command button, do I follow all the
instructions and link the report to the button? Otherwise I need to know what
to do when I create the button so that I can put the code. Hope you
understand my question.

Thanks

*** snipped ***

I don't know what you are doing wrong either, as I am here and you are
there. :-(

Don't use the Wizard when you know the code you wish to use.
So yes, delete any other code in that command button's click event.
The complete code (in that event) should look like this:

Private Sub Command12_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
End Sub

The same goes for the Report Close event. Don't use the Command Button
wizard.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #9  
Old February 27th, 2009, 04:11 PM posted to microsoft.public.access.tablesdbdesign
Christina
external usenet poster
 
Posts: 282
Default criteria

Hi, I got to create the botton without the wizard. When I run the report it
gives me Compile error Invalid Outside procedure.

Thanks

"Christina" wrote:

Hi, The report does not return any data. I created the form with the two
text Boxes as instructed. I added a command button with this code in the
click event.
Private Sub Command21_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
There were some other code in there before the End Sub. Should I delete
that? I tried it both ways anyhow, and it did not run. Don't know what I am
doing wrong.

Christina" wrote:

Small question. WHen I am create the command button, do I follow all the
instructions and link the report to the button? Otherwise I need to know what
to do when I create the button so that I can put the code. Hope you
understand my question.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 19:51:01 -0800, Christina wrote:

Thanks you. I am not sure how to add the code to the click event or code
the main report close event. Please for detail instructions.

Thanks

"fredg" wrote:

On Tue, 24 Feb 2009 13:34:01 -0800, Christina wrote:

I have a report and a subreport run from queries which each require the
input of a beginning date and an ending date. I would like to be requested
to input the criteria once instead of twice.
Thanks

You will need a form for this.
Create a form. Add 2 unbound text controls.
Set their format property to a valid date format.
Name one control "StartDate'.
Name the other control "EndDate".
Add a command button to the form.
Code it's click event:

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

Name this form "ParamForm".

As criteria for the main report query, and also for the sub-report
query, enter, on the Date field's criteria line:
Between Forms!ParamForm!StartDate and Forms!ParamForm!EndDate

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Then when you are ready to run the report, open the form.
Enter the starting and ending dates wanted.
Click the command button.
The report and it's sub report will run.
When the report closes, it will also close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail



For the Form, select the Command Button.
Display the button's property sheet.
Click on the Event tab.
Click on the event line you wish to code, i.e. the Click event.
Write
[Event Procedure]
on that line.
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those lines write your code for the command button.

DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False

For the Report, display the Report's property sheet.
Click on the Close evnet line and follow the same instructions as for
the Form Command button.
Write the code:

DoCmd.Close acForm, "ParamForm"
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #10  
Old February 27th, 2009, 05:18 PM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default criteria

On Thu, 26 Feb 2009 08:56:07 -0800, Christina wrote:

Thanks again. Problem, the only way I k now to create a command button is
with the wizard . Can you please walk me through.

"fredg" wrote:

On Wed, 25 Feb 2009 14:32:01 -0800, Christina wrote:

Hi, The report does not return any data. I created the form with the two
text Boxes as instructed. I added a command button with this code in the
click event.
Private Sub Command21_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
There were some other code in there before the End Sub. Should I delete
that? I tried it both ways anyhow, and it did not run. Don't know what I am
doing wrong.

Christina" wrote:

Small question. WHen I am create the command button, do I follow all the
instructions and link the report to the button? Otherwise I need to know what
to do when I create the button so that I can put the code. Hope you
understand my question.

Thanks

*** snipped ***

I don't know what you are doing wrong either, as I am here and you are
there. :-(

Don't use the Wizard when you know the code you wish to use.
So yes, delete any other code in that command button's click event.
The complete code (in that event) should look like this:

Private Sub Command12_Click()
DoCmd.OpenReport "Reconciliation", acViewPreview
Me.Visible = False
End Sub

The same goes for the Report Close event. Don't use the Command Button
wizard.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


In Design View, click on the Toolbox tool button.
If the Wizard button is down (the button with the wand and falling
stars), click on it to raise it.
Now add your command button. Since the wizard is not turned on, you
can now simply add code to the button's click event using the method I
gave you previously. Don't forget to use the Command button's Caption
property to write whatever button caption you wish.

If you need to use the wizard again in the future, simply open the
toolbox and depress the wizard (the wand with the stars) button.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 




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 05:46 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.