Input Parameter for table based report

G

Guest

Hello!
I have a table based report, which I've created an input parameter form for
to retrieve only those records for the entered quarter. However, it's not
working. The expression is [Forms]![frmSelectQuarter]![Quarter], and I think
the problem I'm having is knowing where to insert this expression. I've
tried inserting it in Report design as a filter, but no matter what is
entered in the input parameter, all records are displayed. I would
appreciate any guidance. Thanks!
 
G

Guest

If the field in the table is a number from 1 to 4 that represents the quarter:
DoCmd.OpenReport "MyReportName", , , "[QuarterField] = " & Me.Quarter
If it is a date field and you want to determine the quarter:
DoCmd.OpenReport "MyReportName", , , "DatePart("q", [QuarterField]) = "
& Me.Quarter
 
G

Guest

Hi Klatuu, This is the first database that I've ever created with Access, so
I'd truly appreciate if you could direct me where I should enter your
suggested expression (the field is a number 1-4). Thank You!

Klatuu said:
If the field in the table is a number from 1 to 4 that represents the quarter:
DoCmd.OpenReport "MyReportName", , , "[QuarterField] = " & Me.Quarter
If it is a date field and you want to determine the quarter:
DoCmd.OpenReport "MyReportName", , , "DatePart("q", [QuarterField]) = "
& Me.Quarter

--
Dave Hargis, Microsoft Access MVP


Audra said:
Hello!
I have a table based report, which I've created an input parameter form for
to retrieve only those records for the entered quarter. However, it's not
working. The expression is [Forms]![frmSelectQuarter]![Quarter], and I think
the problem I'm having is knowing where to insert this expression. I've
tried inserting it in Report design as a filter, but no matter what is
entered in the input parameter, all records are displayed. I would
appreciate any guidance. Thanks!
 
G

Guest

It depends on where you want to open the report. Ususally, it is with a
command button. If this is what you want, put the code in the Click event of
the command button. Here's How:

Open the form in design view
Select the command button
Open the properties dialog (Be sure it is the properties for the button)
Select the Events tab
Select the Click event
Click on the small button with the dots ...
The VBA editor will open with the cursor positioned in the event's click Sub.
Paste the code there. Be sure the names in the code match the names of the
field and the control.
--
Dave Hargis, Microsoft Access MVP


Audra said:
Hi Klatuu, This is the first database that I've ever created with Access, so
I'd truly appreciate if you could direct me where I should enter your
suggested expression (the field is a number 1-4). Thank You!

Klatuu said:
If the field in the table is a number from 1 to 4 that represents the quarter:
DoCmd.OpenReport "MyReportName", , , "[QuarterField] = " & Me.Quarter
If it is a date field and you want to determine the quarter:
DoCmd.OpenReport "MyReportName", , , "DatePart("q", [QuarterField]) = "
& Me.Quarter

--
Dave Hargis, Microsoft Access MVP


Audra said:
Hello!
I have a table based report, which I've created an input parameter form for
to retrieve only those records for the entered quarter. However, it's not
working. The expression is [Forms]![frmSelectQuarter]![Quarter], and I think
the problem I'm having is knowing where to insert this expression. I've
tried inserting it in Report design as a filter, but no matter what is
entered in the input parameter, all records are displayed. I would
appreciate any guidance. Thanks!
 
G

Guest

My input parameter form command button has my macro MSelectQuarter.OK as the
code. My macro's action is SetValue. Should the macro be modified?


Klatuu said:
It depends on where you want to open the report. Ususally, it is with a
command button. If this is what you want, put the code in the Click event of
the command button. Here's How:

Open the form in design view
Select the command button
Open the properties dialog (Be sure it is the properties for the button)
Select the Events tab
Select the Click event
Click on the small button with the dots ...
The VBA editor will open with the cursor positioned in the event's click Sub.
Paste the code there. Be sure the names in the code match the names of the
field and the control.
--
Dave Hargis, Microsoft Access MVP


Audra said:
Hi Klatuu, This is the first database that I've ever created with Access, so
I'd truly appreciate if you could direct me where I should enter your
suggested expression (the field is a number 1-4). Thank You!

Klatuu said:
If the field in the table is a number from 1 to 4 that represents the quarter:
DoCmd.OpenReport "MyReportName", , , "[QuarterField] = " & Me.Quarter
If it is a date field and you want to determine the quarter:
DoCmd.OpenReport "MyReportName", , , "DatePart("q", [QuarterField]) = "
& Me.Quarter

--
Dave Hargis, Microsoft Access MVP


:

Hello!
I have a table based report, which I've created an input parameter form for
to retrieve only those records for the entered quarter. However, it's not
working. The expression is [Forms]![frmSelectQuarter]![Quarter], and I think
the problem I'm having is knowing where to insert this expression. I've
tried inserting it in Report design as a filter, but no matter what is
entered in the input parameter, all records are displayed. I would
appreciate any guidance. Thanks!
 
G

Guest

Should your suggested expression be used on a Switchboard command button for
opening the report?
Thanks!

Audra said:
My input parameter form command button has my macro MSelectQuarter.OK as the
code. My macro's action is SetValue. Should the macro be modified?


Klatuu said:
It depends on where you want to open the report. Ususally, it is with a
command button. If this is what you want, put the code in the Click event of
the command button. Here's How:

Open the form in design view
Select the command button
Open the properties dialog (Be sure it is the properties for the button)
Select the Events tab
Select the Click event
Click on the small button with the dots ...
The VBA editor will open with the cursor positioned in the event's click Sub.
Paste the code there. Be sure the names in the code match the names of the
field and the control.
--
Dave Hargis, Microsoft Access MVP


Audra said:
Hi Klatuu, This is the first database that I've ever created with Access, so
I'd truly appreciate if you could direct me where I should enter your
suggested expression (the field is a number 1-4). Thank You!

:

If the field in the table is a number from 1 to 4 that represents the quarter:
DoCmd.OpenReport "MyReportName", , , "[QuarterField] = " & Me.Quarter
If it is a date field and you want to determine the quarter:
DoCmd.OpenReport "MyReportName", , , "DatePart("q", [QuarterField]) = "
& Me.Quarter

--
Dave Hargis, Microsoft Access MVP


:

Hello!
I have a table based report, which I've created an input parameter form for
to retrieve only those records for the entered quarter. However, it's not
working. The expression is [Forms]![frmSelectQuarter]![Quarter], and I think
the problem I'm having is knowing where to insert this expression. I've
tried inserting it in Report design as a filter, but no matter what is
entered in the input parameter, all records are displayed. I would
appreciate any guidance. Thanks!
 
G

Guest

I used the "Microsoft Office Online: Help and How-to: Create a form to enter
report criteria". The step where I think I'm doing something wrong is "Enter
the criteria in the underlying query or stored procedures for the report."

Since the report is table based and not query based, where should my
expression [Forms]![frmSelectQuarter]![Quarter] be added? I tried including
it in the report design filter, but it still returns all records. I tried
the DoCmd suggestion in my input parameter form & then the switchboard OK
command, but I get a syntax error using the following: DoCmd.OpenReport
"rpt06FindingsByDirector2" , , , "[Quarter] = " & Me.Quarter

Any additional help would be appreciated. Thanks!
 
G

Guest

I was able to create a new form with a command button and added the DoCmd
expression to the code, and it printed the correct results based on the input
parameter! Yeah!

However, since management wants to be able to run the report from the
Switchboard and not another form, any help on where I can enter the
expression?

Thanks!
 
G

Guest

FYI... I started over by creating a report based on a query instead of
tables. And, the input parameter worked using
[Forms]![frmSelectQuarter]![Quarter] as the criteria for the Quarter field of
the underlying query. So, I no longer need assistance... with this
situation at least. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top