Preview/Print reports from selections in unbound combo box.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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) and is bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo box and then
click the Preview or Print Buttons to generate the selected report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
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>
 
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
 
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>


JohnLute said:
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


Jeff Boyce said:
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>

wonder
if is
bound
 
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


Jeff Boyce said:
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>


JohnLute said:
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


Jeff Boyce said:
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>

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) and is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo box and then
click the Preview or Print Buttons to generate the selected report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
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>

JohnLute said:
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


Jeff Boyce said:
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>


JohnLute said:
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>

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)
and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo box
and
then
click the Preview or Print Buttons to generate the selected report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
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


Jeff Boyce said:
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>

JohnLute said:
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


Jeff Boyce said:
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>

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) and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo box and
then
click the Preview or Print Buttons to generate the selected report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
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>

JohnLute said:
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


Jeff Boyce said:
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>

JohnLute said:
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>

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)
and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo
box
and
then
click the Preview or Print Buttons to generate the selected report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
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


Jeff Boyce said:
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>

JohnLute said:
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


Jeff Boyce said:
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>

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)
and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo box
and
then
click the Preview or Print Buttons to generate the selected
report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
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>

JohnLute said:
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


Jeff Boyce said:
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>

JohnLute said:
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>

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)
and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the
combo
box
and
then
click the Preview or Print Buttons to generate the selected
report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
Yes - print ALL or every report on the list.

I thought the Cancel print button would be handy but you're right - this can
be done via Windows and would be overkill.

--
www.Marzetti.com


Jeff Boyce said:
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>

JohnLute said:
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


Jeff Boyce said:
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>

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)
and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from the combo
box
and
then
click the Preview or Print Buttons to generate the selected
report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
John

To print all of the reports on the list, one approach would be to cycle
through the list in code, opening the report for each one. Do you want to
have all these happen at once (potential for running out of memory/resources
here)?

Another approach might be to string together the reports, so that the first
one closing opens the second, etc. This will NOT let you pick just one.

I'm not clear on when/why you'd want to run all reports, but still be able
to pick one.

Regards

Jeff Boyce
<Access MVP>
JohnLute said:
Yes - print ALL or every report on the list.

I thought the Cancel print button would be handy but you're right - this can
be done via Windows and would be overkill.

--
www.Marzetti.com


Jeff Boyce said:
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>

JohnLute said:
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>

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)
and
is
bound
to column 1.

Preview/Print Buttons.
I've created this button named Preview.

What I'd like to do is simply make a selection from
the
combo
box
and
then
click the Preview or Print Buttons to generate the selected
report.

I appreciate any help with this.

Thanks!!!
my code skills are
 
Hi, Jeff!

My reports are actually packaging specifications. Each spec has its own
format. For example "Approval Routing" has approval routing data. "INTERNAL"
has data that is shared within Marzetti. "EXTERNAL" has data that is shared
outside Marzetti. Etc., etc. Therefore, glass bottles, plastic cups,
corrugated boxes, etc. have their own specs accordingly.

Printing all of the specs with one click is desirable as users may need to
print out all of them at one time in order to answer a spec request.
Basically, the print all function will be printing all of the specs of one
open record. Therefore, I don't foresee any memory issues as the specs are
small and few enough that to print them all at once won't take many system
resources.

Cycling through the list in code sounds like the best solution. How can I do
this?

THANKS!!!

--
www.Marzetti.com


Jeff Boyce said:
John

To print all of the reports on the list, one approach would be to cycle
through the list in code, opening the report for each one. Do you want to
have all these happen at once (potential for running out of memory/resources
here)?

Another approach might be to string together the reports, so that the first
one closing opens the second, etc. This will NOT let you pick just one.

I'm not clear on when/why you'd want to run all reports, but still be able
to pick one.

Regards

Jeff Boyce
<Access MVP>
JohnLute said:
Yes - print ALL or every report on the list.

I thought the Cancel print button would be handy but you're right - this can
be done via Windows and would be overkill.

--
www.Marzetti.com


Jeff Boyce said:
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)
 
John

Generically, you could use a For... Next or For Each ... Next loop to step
through the list, one-by-one, and inside the loop, open the report.

Have you considered the possibility of creating a "master" report, and
embedding each of your "specs" reports as subreports? This would let you
print a single report (the master) and include all the subreports.

--
Regards

Jeff Boyce
<MS Office/Access MVP>

JohnLute said:
Hi, Jeff!

My reports are actually packaging specifications. Each spec has its own
format. For example "Approval Routing" has approval routing data. "INTERNAL"
has data that is shared within Marzetti. "EXTERNAL" has data that is shared
outside Marzetti. Etc., etc. Therefore, glass bottles, plastic cups,
corrugated boxes, etc. have their own specs accordingly.

Printing all of the specs with one click is desirable as users may need to
print out all of them at one time in order to answer a spec request.
Basically, the print all function will be printing all of the specs of one
open record. Therefore, I don't foresee any memory issues as the specs are
small and few enough that to print them all at once won't take many system
resources.

Cycling through the list in code sounds like the best solution. How can I do
this?

THANKS!!!

--
www.Marzetti.com


Jeff Boyce said:
John

To print all of the reports on the list, one approach would be to cycle
through the list in code, opening the report for each one. Do you want to
have all these happen at once (potential for running out of memory/resources
here)?

Another approach might be to string together the reports, so that the first
one closing opens the second, etc. This will NOT let you pick just one.

I'm not clear on when/why you'd want to run all reports, but still be able
to pick one.

Regards

Jeff Boyce
<Access MVP>
JohnLute said:
Yes - print ALL or every report on the list.

I thought the Cancel print button would be handy but you're right -
this
can
be done via Windows and would be overkill.

--
www.Marzetti.com


:

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)
 
Thanks, Jeff. I'm strongly considering a "master" report. This may be an
easier approach but I will have to test it out.

In the meantime, I'm not at all familiar with the techniques you noted
below. Could you perhaps give me an example?

Thanks for all your help!

--
www.Marzetti.com


Jeff Boyce said:
John

Generically, you could use a For... Next or For Each ... Next loop to step
through the list, one-by-one, and inside the loop, open the report.

Have you considered the possibility of creating a "master" report, and
embedding each of your "specs" reports as subreports? This would let you
print a single report (the master) and include all the subreports.

--
Regards

Jeff Boyce
<MS Office/Access MVP>

JohnLute said:
Hi, Jeff!

My reports are actually packaging specifications. Each spec has its own
format. For example "Approval Routing" has approval routing data. "INTERNAL"
has data that is shared within Marzetti. "EXTERNAL" has data that is shared
outside Marzetti. Etc., etc. Therefore, glass bottles, plastic cups,
corrugated boxes, etc. have their own specs accordingly.

Printing all of the specs with one click is desirable as users may need to
print out all of them at one time in order to answer a spec request.
Basically, the print all function will be printing all of the specs of one
open record. Therefore, I don't foresee any memory issues as the specs are
small and few enough that to print them all at once won't take many system
resources.

Cycling through the list in code sounds like the best solution. How can I do
this?

THANKS!!!

--
www.Marzetti.com


Jeff Boyce said:
John

To print all of the reports on the list, one approach would be to cycle
through the list in code, opening the report for each one. Do you want to
have all these happen at once (potential for running out of memory/resources
here)?

Another approach might be to string together the reports, so that the first
one closing opens the second, etc. This will NOT let you pick just one.

I'm not clear on when/why you'd want to run all reports, but still be able
to pick one.

Regards

Jeff Boyce
<Access MVP>
Yes - print ALL or every report on the list.

I thought the Cancel print button would be handy but you're right - this
can
be done via Windows and would be overkill.

--
www.Marzetti.com


:

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>


message
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
 

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

Back
Top