473,756 Members | 2,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prompted for parameter on OpenReport

Hello,

I'm trying to limit a report to a list of parameters that I pass in.
The report and the underlying query both use the column FirstName.
Whenever I try to limit the FirstName in via the "Where" clause, I get
prompted to input the FirstName parameter, even though I'm passing it
in via OpenReport

The syntax I tried using:

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = ""John"")"

-- And --

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = 'John')"

My sql query is
select firstname, lastname from employee

I've poured through a ton of newsgroup postings related to OpenReport
and haven't come up with a solution. I have tried many variations on
the syntax, and tried using filters instead, but I keep getting
prompted to give a FirstName. Even when I do give a valid FirstName,
the query isn't limited and I keep getting a complete list of
employees.

Is there some other area in Access that I should be troubleshooting
besides the OpenReport syntax?

Thanks in advance for any help you can provide.

Aaron
Nov 12 '05 #1
3 12999
My guess is, the filter you are trying to pass to the OpenReport is not
based on the data source for the report, as it is apparently a query,
not the Employees table.
Why not place the criteria into the source query in the first place:

select firstname, lastname from employee where firstname = "John"

and use this SQL as the report's data source?
If you have to define the filter at runtime, you have options: in 2002,
you can use OpenArgs; in earlier you have to use the report's Open event
to obtain the filtering criteria.
Pavel

Aaron wrote:

Hello,

I'm trying to limit a report to a list of parameters that I pass in.
The report and the underlying query both use the column FirstName.
Whenever I try to limit the FirstName in via the "Where" clause, I get
prompted to input the FirstName parameter, even though I'm passing it
in via OpenReport

The syntax I tried using:

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = ""John"")"

-- And --

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = 'John')"

My sql query is
select firstname, lastname from employee

I've poured through a ton of newsgroup postings related to OpenReport
and haven't come up with a solution. I have tried many variations on
the syntax, and tried using filters instead, but I keep getting
prompted to give a FirstName. Even when I do give a valid FirstName,
the query isn't limited and I keep getting a complete list of
employees.

Is there some other area in Access that I should be troubleshooting
besides the OpenReport syntax?

Thanks in advance for any help you can provide.

Aaron

Nov 12 '05 #2
Aaron,

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal, ,"[firstname] = 'John'"

Why are you hard coding this?
Do you intend to recode each time you want a report with a different first
name?

The simplest way is to just change the query:
SELECT Employee.FirstN ame, Employee.LastNa me
FROM Employee
WHERE Employee.FirstN ame =[Enter First Name];

Then run the report.

You'll be prompted for the name when you open the report.

If you have a form displaying the employee records, then you would use:
Docmd.OpenRepor t "ShowEmployees" , acViewNormal, , "[FirstName] = '" &
Me![FirstName] & "'"

Whatever the [FirstName] is that is on the record displayed on the form will
be the one filtered in the report.
John Smith, John Anderson, John Jones, etc.
In this case do not use the query criteria.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"Aaron" <de************ ****@hotmail.co m> wrote in message
news:c5******** *************** ***@posting.goo gle.com...
Hello,

I'm trying to limit a report to a list of parameters that I pass in.
The report and the underlying query both use the column FirstName.
Whenever I try to limit the FirstName in via the "Where" clause, I get
prompted to input the FirstName parameter, even though I'm passing it
in via OpenReport

The syntax I tried using:

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = ""John"")"

-- And --

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = 'John')"

My sql query is
select firstname, lastname from employee

I've poured through a ton of newsgroup postings related to OpenReport
and haven't come up with a solution. I have tried many variations on
the syntax, and tried using filters instead, but I keep getting
prompted to give a FirstName. Even when I do give a valid FirstName,
the query isn't limited and I keep getting a complete list of
employees.

Is there some other area in Access that I should be troubleshooting
besides the OpenReport syntax?

Thanks in advance for any help you can provide.

Aaron

Nov 12 '05 #3
how or where did you try to run this from? I generically recreated
what you say you did, and I didn't have any trouble. Here is what I
did:
1. I created a table 'zz' with an Id, fname, & lname fields. I entered
ONE entry: fname = 'scott', lname = 'bradley'.

2. I created a query 'qz' to queries all 3 fields from 'zz'
3. I created a report 'showEmployees' based on 'qz'
4. I then created in funtion in module1, called 'showReport' [this is
where I'm wondering how/where you are calling 'OpenReport']

5. the function has this one statement:
doCmd.OpenRepor t "showEmployees" , acViewPreview,, "([zz].[fname] =
""scott"")"
6. I then created a macro 'a' with only one action, "RunCode" with the
function name showReport().
7. after executing the macro, I got a preview of the report with all
three fields shown: id = 1, fname=scott, lname=bradley

So, we probably need more info about how you are executing
'OpenReport'.

-PT

de************* ***@hotmail.com (Aaron) wrote in message news:<c5******* *************** ****@posting.go ogle.com>...
Hello,

I'm trying to limit a report to a list of parameters that I pass in.
The report and the underlying query both use the column FirstName.
Whenever I try to limit the FirstName in via the "Where" clause, I get
prompted to input the FirstName parameter, even though I'm passing it
in via OpenReport

The syntax I tried using:

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = ""John"")"

-- And --

DoCmd.OpenRepor t "ShowEmployees" , acViewNormal,
,"([employee].[firstname] = 'John')"

My sql query is
select firstname, lastname from employee

I've poured through a ton of newsgroup postings related to OpenReport
and haven't come up with a solution. I have tried many variations on
the syntax, and tried using filters instead, but I keep getting
prompted to give a FirstName. Even when I do give a valid FirstName,
the query isn't limited and I keep getting a complete list of
employees.

Is there some other area in Access that I should be troubleshooting
besides the OpenReport syntax?

Thanks in advance for any help you can provide.

Aaron

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3875
by: Andrew | last post by:
Hi All: I am using Access2000 and I find that the command to open an Access report in preview mode is very slow: DoCmd.OpenReport rptABC, acViewPreview, "", "" The scenario is this: - The following codes are written in the VB Applcation. - Prior to opening the report, I set its recordsource with a sql: ..Reports!rptABC.RecordSource = sSql. The sSql searches for a specific
1
2238
by: Colin | last post by:
I created a macro that starts a filter on a query. The criteria in the query is: Like & "*" The macro is initiated by pressing a command button on the form. This works fine. However, when this form becomes an unbound subform of another main form, I'm prompted twice for the value of the filter (i.e. the group name to enter). How can I stop the double prompt when my form is used
4
4742
by: dixie | last post by:
I have an extended multi-select list box of names in which the bound column is a person ID field called ID (text, not numerical). I want that list to act as a parameter in a query that is simply going to produce a medical report for each person in the list box. Now, I know this should be easy. My query for the medical report only has 4 fields, ID, Firstname, Lastname, Medical, but I cant seem to use the listbox of names to act as...
1
2702
by: mark | last post by:
I've got a report whose recordsource is a query: SELECT .Company, qryGatherCreditCardInfoFromCallRecords.* FROM qryGatherCreditCardInfoFromCallRecords LEFT JOIN ( LEFT JOIN ON .=.) ON qryGatherCreditCardInfoFromCallRecords.=.; The subquery, qryGatherCreditCardInfoFromCallRecords, takes 1 parameter, .
3
10754
by: bruce | last post by:
Hello, In Access 2003 one can use OpenReport with the acDialog parameter to open a report modally. However, doing this prevents the report's toolbars from displaying. Is there a way around this? I would like to be able to open a report modally and still allow my users to print in the way they've become accustomed to, i.e., by clicking on the Print button on the toolbar. Bruce
2
5426
by: mudman04 | last post by:
Hi, I searched online for some similar issues that I am facing but was not able come up with anything. I am fairly new with Access (2 months experience) and I am trying to remove a message stating, ENTER PARAMETER VALUE when I am generating a report. I know that the culprit lies in the query stored in the report. I have entered data in the CRITERIA (entered forms!frmproducts!lngproductID) window and OR (entered...
12
10842
by: karanj | last post by:
Hi all, I'm facing an issue with Access that I haven't been able to find a solution for, despite hours of googling, so I hope someone here can help! I've got a report - rptClientsByCountry - which is based on a query - qryClientsByCountry - that takes a parameter, myCountry, to filter the results. I need to be able to generate this report depending on the user's choice of country, preferably from a drop-down list. Leaving aside for a...
10
1782
by: akirekab | last post by:
I am running a report in Access. When I click to run report, a dialog comes up for missing parameter, showing just the name of a table in the box. Now if I just click ok without typing anything in, the report dispays perfectly. But user wants it gone, and I am at a loss. Here is click Event code: Dim stDocName As String Dim strFilter As String
6
4301
by: xraive | last post by:
I am trying to pass the parameters when I open a report but the report opens with all records instead of being filtered. Dim strReport As String Dim strDateField As String Dim startDate As String Dim endDate As String Dim strWhere As String Dim lngView As Long Const strcJetDate = "\#mm\/dd\/yyyy\#" strDateField=
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.