Prev: Sorting/Grouping ... Show a month if Zero (Access 2007)
Next: Complex Count function with a condition
From: Paul Kraemer on 24 May 2010 11:09 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
From: Steve on 24 May 2010 11:18 Hi Paul, Try this: ........ WHERE MyTable.Tag1 = [Enter Tag1 Value] Steve santus(a)penn.com "Paul Kraemer" <PaulKraemer(a)discussions.microsoft.com> wrote in message news:B46728A5-92C2-461E-B37A-CFF190517607(a)microsoft.com... > 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
From: Duane Hookom on 24 May 2010 11:40
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/Forums/en-US/addbuz/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 |