473,473 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

report rowsource query

DL
Hi,
I want to specify the query that will be used in a report by giving options
in a form.
then with a command button the following will happen:
-------------
QRY= "SELECT * FROM registration"

DoCmd.OpenReport "report", acViewPreview, , QRY
-------------
I have simplified the query for this example but it doesn't work with this
either...
Lets say I have only one field to show in my report: personal ID --> pid
I still get #Name?

Can anyone help me put this QRY right so it will work with the OpenReport
command and
setting my QRY as a recordsource(I guess it should be done this way)

Thanks!!!!


Nov 13 '05 #1
2 2593
The WhereCondition argument of OpenReport is not a full query: just the
WHERE clause.

Taking your example of a file called "pid", and assuming that you want to
use the number in the text box called "pid" on your form, try:

Dim strWhere As String
strWhere = "pid = " & Me.pid
DoCmd.OpenReport "report", acViewPreview, , strWhere

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DL" <da*******@hotmail.com> wrote in message
news:40*********************@news.wanadoo.nl...

I want to specify the query that will be used in a report by giving options in a form.
then with a command button the following will happen:
-------------
QRY= "SELECT * FROM registration"

DoCmd.OpenReport "report", acViewPreview, , QRY
-------------
I have simplified the query for this example but it doesn't work with this
either...
Lets say I have only one field to show in my report: personal ID --> pid
I still get #Name?

Can anyone help me put this QRY right so it will work with the OpenReport
command and
setting my QRY as a recordsource(I guess it should be done this way)

Nov 13 '05 #2
QRY have to be a filter, not a row source like

"personalId='"& me.pid & "'"

in your case if pid is a text.
"DL" <da*******@hotmail.com> wrote in message
news:40*********************@news.wanadoo.nl...
Hi,
I want to specify the query that will be used in a report by giving options in a form.
then with a command button the following will happen:
-------------
QRY= "SELECT * FROM registration"

DoCmd.OpenReport "report", acViewPreview, , QRY
-------------
I have simplified the query for this example but it doesn't work with this
either...
Lets say I have only one field to show in my report: personal ID --> pid
I still get #Name?

Can anyone help me put this QRY right so it will work with the OpenReport
command and
setting my QRY as a recordsource(I guess it should be done this way)

Thanks!!!!

Nov 13 '05 #3

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

Similar topics

2
by: Geir Baardsen | last post by:
Hi! From a listbox I'd like to send only selected items to a report. Items will include: OrderNr,Date,EmployeeNr from tblOrders ZipCode,City from tblZipCodes Name,Adr,ZipID from...
1
by: Tim Marshall | last post by:
A2003. I am getting this error message when I try to set a report's recordsource to an SQL statement or a saved querydef that uses sub-queries. I've debug.printed the SQL, and run it as a stand...
8
by: | last post by:
hi, i have a form on which a user can choose specific criteria such as dates etc, in order to filter the report that is called from the form. i do this by using the Where section of the...
18
by: simonmarkjones | last post by:
Hi all, I create a report to act as a receipt to customers. The report displays all the customer payment details and then i print this. This works fine. However, i now want to add some more...
3
by: ML | last post by:
I have used Allen Brown's technique for filling a listbox on a form with the names of files in a certain disc folder. It works well. I am now giving the user the option to print the form...
3
by: u473 | last post by:
How do I call a reusable report with a modifiable Rowsource property and or code ? Like in the following case where the table name will change any following day ? I am using Access 2003. ...
5
by: dkintheuk | last post by:
Is it possible to set (using VBA) the rowsource for a combo box but have that rowsource come from a pass-through query. I can obviously manually go into the rowsource property and define the...
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
1
by: ikuyasu | last post by:
Hi, I am trying to create a report that takes a value from the field on a table as a group category. But The value on the report takes an id number (auto increment, and the first column)...
0
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,...
0
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,...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.