By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

Access Report using just the current record in a form.

P: 6
I have a report to create a catalog of books from an Access table - it works great. Sometimes I need to print out ONLY the record that is currently shown in a form (for example, to place it with a specific book). Is there an easy way to specify that the report (or a copy of it) prints ONLY the selected record? Sorry - I have very little programming experience!
Thanks.
Nov 22 '06 #1
Share this Question
Share on Google+
6 Replies


NeoPa
Expert Mod 15k+
P: 31,660
If you call the report from the form, then add the value you want to the WhereCondition argument.
OpenReport Method
The OpenReport method carries out the OpenReport action in Visual Basic.

expression.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
expression Required. An expression that returns a DoCmd object.

ReportName Required Variant. A string expression that's the valid name of a report in the current database. If you execute Visual Basic code containing the OpenReport method in a library database, Microsoft Access looks for the report with this name, first in the library database, then in the current database.

View Optional AcView. The view to apply to the specified report.

AcView can be one of these AcView constants.
acViewDesign
acViewNormal default Prints the report immediately.
acViewPivotChart Not supported.
acViewPivotTable Not supported.
acViewPreview

FilterName Optional Variant. A string expression that's the valid name of a query in the current database.

WhereCondition Optional Variant. A string expression that's a valid SQL WHERE clause without the word WHERE.

WindowMode Optional AcWindowMode. The mode in which the form opens.

AcWindowMode can be one of these AcWindowMode constants.
acDialog The form's Modal and PopUp properties are set to Yes.
acHidden The form is hidden.
acIcon The form opens minimized in the Windows taskbar.
acWindowNormal default The form is in the mode set by its properties.

OpenArgs Optional Variant. Sets the OpenArgs property.
Nov 22 '06 #2

P: 6
If you call the report from the form, then add the value you want to the WhereCondition argument.
As we say in Ireland NeoPa, "thanks a million"! I have not tried your soluton yet (because it's verrrry late) but will do it tomorrow.
Nov 22 '06 #3

NeoPa
Expert Mod 15k+
P: 31,660
You're welcome.
You 're in distinguished company here - probably our best expert in this forum is also from The Fair Isle.
As she (Mary - good solid Irish name) goes under the tag of MMcCarthy I suppose it's too much of a surprise from where she hales.
Nov 22 '06 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
You're welcome.
You 're in distinguished company here - probably our best expert in this forum is also from The Fair Isle.
As she (Mary - good solid Irish name) goes under the tag of MMcCarthy I suppose it's too much of a surprise from where she hales.
Now Adrian,

I'm flattered, but you do know that the McCarthy clan have taken over the world by now and can be found in all corners of the earth.

Mary
Nov 22 '06 #5

P: 6
NeoPa,
It works perfectly. I had read the stuff you sent me already, but did not understand it. thanks a million.
John.
Nov 26 '06 #6

NeoPa
Expert Mod 15k+
P: 31,660
You're welcome John.

I'm naturally lazy - I like easy questions :)
Nov 26 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.