only the current record in a report?

A

Arjan

Hi,

How can I use only the current record in a report?
At this momnet when I make a report the whole database is imported in the
reoprt and I only want to use the current record.

I know it is possible, but how?

Arjan
the Netherlands
 
J

Jeff Boyce

Arjan

Check the DoCmd.OpenReport command for syntax. There's a way to filter or
use a SQL-like WHERE expression. Take a look at Access HELP on this -- the
examples should show a way to limit the report to the "current" record
(usually used to describe "the record on my screen right now").
 
G

Guest

I assume you are on a form showing the current record and clicking a button
to do the report ?
If so use this behind the click event of the button where UniqueID is the
unique identifier in the underlying table or query and Me.UniqueID is the
same on the form and are numeric values. If a text value is the unique
identifier then use the 2nd statment.
DoCmd.OpenReport "YourReportName", , , "UniqueID = " & Me.UniqueID
DoCmd.OpenReport "YourReportName", , , "UniqueID = '" & Me.UniqueID & "'"
 
A

Arjan

Dennis,

Thanks for your awnser. What you assume is correct.
I'm in a form and I want to generate a report with the current record by
clicking a button. (this button is on an other tabpage)
However, I'm still having difficulties to get it work properly.

I have used your first line:
DoCmd.OpenReport "YourReportName", , , "UniqueID = " & Me.UniqueID
as my UniqueID (my name is BoekingsformulierID) is an autogenerated number.
If I have understand your e-mail correctly the line then then becomes;
DoCmd.OpenReport "Test rapport", , , "BoekingsformulierID = " &
Me.BoekingsformulierID

When I run this code it immediatly ask me to print it (this is not correct,
I want to do a visual ckeck before I print it)
After I agreed to print it, an inputbox appears where it askes for a
BoekingsformulierID number.
When I have inputed an exsisting BoekingsformulierID number it start to
print the whole range of the Dbase.

Do you know what I am doing wrong?

Arjan
The Netherlands
 
G

Guest

To do a visual check first use the line
DoCmd.OpenReport "Test rapport", acViewPreview, , "BoekingsformulierID = " &
Me.BoekingsformulierID
For this to work, the BoekingsformulierID must be a bound field on your form
to uniquely identify the current record and must also be in the record source
that the report is based on i.e. the query or the table.
 

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