John
Print ALL (of what?) Do you mean every report on the list?
Print CANCEL (where?) Do you mean once the printer starts, you want to
cancel? You can do that via Windows.
Regards
Jeff Boyce
<Access MVP>
Wonderful! That does the trick - THANKS! I also removed that filter and
got
the Print button working.
Now I have 2 more thoughts:
1. How can I code a Print ALL button?
2. How can I code a Print CANCEL button?
Do you use similar in your design?
--
www.Marzetti.com
:
John
I use a similar (lookup) table of reports. I have one column that holds
the
"Access" report name, a second column that holds a "user-friendly" name,
and
a third that holds a description.
I use a combo box to allow the user to select a user-friendly-name
report,
but the combo box is bound to the Access report name. Thus, using the
value
of the combo box returns the Access report name.
Regards
Jeff Boyce
<Access MVP>
Thanks, Jeff.
Yes, the name of the report would/could/should be in the box, however,
the
report names are unusual like "rptFinishedGoodAPPROVAL"
These names will look strange to users who are unfamiliar with this
format.
Kind of like how code is relatively unfamiliar to me which results in
confusion. Therefore, I use a lookup table which gives the report a
more
"user-friendly" name like "Approval Routing" and "INTERNAL Spec."
As for the filter. This was developed awhile back per a suggestion
from
this
forum. Since you've brought it up I've been reviewing this for
revision.
--
www.Marzetti.com
:
John
I'll ask again, a different way.
As I interpreted your earlier posts, you have a combo box that looks
up
report titles. If so, the name of the report you want
would/could/should be
what your combo box holds, after selection.
I still don't understand why you are using a filter in your
OpenReport
code?
Regards
Jeff Boyce
<Access MVP>
Thanks, Jeff!
With the lookup table involved I guess my thinking is that there's
more to
this. Here's what I now have:
Private Sub Preview_Click()
On Error GoTo Err_Preview_Click
DoCmd.OpenReport Me!cbSelectReport, acPreview, ,
"[tblProfiles.txtProfileID]
= Forms![frmFinishedGoods].form![txtProfileID]"
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
MsgBox Err.Description
Resume Exit_Preview_Click
End Sub
This results in a 'Report named "INTERNAL Spec" is either
misspelled
or
doesn't exist. Thisis because cbSelectReport is referencing the
lookup
table
that I noted in my initial post.
How do I code in this table?
--
www.Marzetti.com
:
John
Consider:
DoCmd.OpenReport Me!MyComboBox, acPreview
This tells Access to use the contents of the control named
"MyComboBox".
I'm not sure how the "filter" code helps, and don't recall you
mentioning
that (see
"[tblProfiles.txtProfileID] =
Forms![frmFinishedGoods].form![txtProfileID]"
Don't you just need to know which report was selected from your
combo
box?
Regards
Jeff Boyce
<Access MVP>
Thanks, Jeff. I've made these buttons before through the
wizard,
however,
in
this instance, the wizard is of little help as it doesn't
automatically
generate the code I need to achieve my goal. My code skills
are
very
poor
and
I have no idea how to modify the code:
On Error GoTo Err_Preview_Click
DoCmd.OpenReport "rptFinishedGoods", acPreview, ,
"[tblProfiles.txtProfileID] =
Forms![frmFinishedGoods].form![txtProfileID]"
Exit_cmdPreview_Click:
Exit Sub
Err_cmdPreview_Click:
MsgBox Err.Description
Resume Exit_cmdPreview_Click
End Sub
--
www.Marzetti.com
:
You may be able to use the command button wizard to help.
Try
working
in
design mode on your form, and adding a new command button.
For
a
choice,
run/open a report.
Then, look at the code it created. You'll need to add
something
that
tells
the code to get the report name from the combo box.
Regards
Jeff Boyce
<Access MVP>
message
I would like to preview/print reports from selections in
an
unbound
combo
box. This is a big deal to me as I have very little code
skills. I
wonder
if
anyone could help me throw this together? Here are the
specifics:
LookUp Table.
I've created a LookUp Table tblFinishedGoodREPORTNAMES
with
these
fields:
FGReportName
Description
ReportToOpen
Combo Box.
I've created an unbound combo box named SelectReport that
sources
the
LookUp
Table. It has a column count of 2 (FGReportName and
Description)