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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using a parameter in a report



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2010, 04:09 PM posted to microsoft.public.access.reports
Paul Kraemer
external usenet poster
 
Posts: 80
Default Using a parameter in a report

Hi,

I am using Access 2007. I have created a report where the RecordSource is
set to something like the following:

SELECT MyTable.Tag1, MyTable.Tag2 FROM MyTable WHERE MyTable.Tag1 = 999;

The WHERE clause is hard coded so that it only looks for records where Tag1
= 999. Rather than having this hard-coded, I would like to make use of a
parameter so that when I run the report, it will ask me to enter the Tag1
value I want to use for filtering the report.

If anyone can tell me how to do this or point me towards something I can
read that would be helpful, I'd really appreciate it.

Thanks in advance,
Paul

--
Paul Kraemer
  #3  
Old May 24th, 2010, 04:40 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Using a parameter in a report

I don't care for parameter prompts. Consider adding a text box (or maybe a
combo box) on a form to use for the criteria. Then your SQL might look like:

SELECT MyTable.Tag1, MyTable.Tag2
FROM MyTable
WHERE MyTable.Tag1 = Forms!frmMyCriteria!cboTag1;

--
Duane Hookom
Microsoft Access MVP

NOTE: These public News Groups are ending June 1st. Consider asking
questions at http://social.answers.microsoft.com/...ddbuz/threads?


"Paul Kraemer" wrote:

Hi,

I am using Access 2007. I have created a report where the RecordSource is
set to something like the following:

SELECT MyTable.Tag1, MyTable.Tag2 FROM MyTable WHERE MyTable.Tag1 = 999;

The WHERE clause is hard coded so that it only looks for records where Tag1
= 999. Rather than having this hard-coded, I would like to make use of a
parameter so that when I run the report, it will ask me to enter the Tag1
value I want to use for filtering the report.

If anyone can tell me how to do this or point me towards something I can
read that would be helpful, I'd really appreciate it.

Thanks in advance,
Paul

--
Paul Kraemer

 




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 07:43 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.