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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
only the current record in a report?
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 |
#2
|
|||
|
|||
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"). -- Good luck Jeff Boyce Access MVP "Arjan" wrote in message ... 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 |
#3
|
|||
|
|||
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 & "'" "Arjan" wrote: 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 |
#4
|
|||
|
|||
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 "Dennis" schreef in bericht ... 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 & "'" "Arjan" wrote: 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 |
#5
|
|||
|
|||
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. "Arjan" wrote: 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 "Dennis" schreef in bericht ... 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 & "'" "Arjan" wrote: 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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
To Sharkbyte and all: Calculate a total values in group level | Ally | General Discussion | 6 | June 13th, 2005 08:16 PM |
Current Record Count, Previous Record #, Add New Record | Robert Nusz @ DPS | Using Forms | 0 | February 15th, 2005 08:35 PM |
Report based on a new record doesn't display record | J.Sera | Setting Up & Running Reports | 1 | December 31st, 2004 06:55 PM |
Restrict Report To Current Record | Katherine R | Setting Up & Running Reports | 1 | July 15th, 2004 07:23 PM |
email report with current record | Mario | Setting Up & Running Reports | 1 | May 26th, 2004 10:04 PM |