Printing muilt reports

  • Thread starter jln via AccessMonster.com
  • Start date
J

jln via AccessMonster.com

What i have is 6 reports attached to buttons that have the user enter the
INV# when pressed this runs a query that generates each report. What i need
to have it do is enter the inv# number once and all 6 reports print. Also all
six reports run a different query. So any ideas.
 
D

Duane Hookom

If you have "buttons", you must have a form. Add a combo box [cboInvNum] to
select the inventory number. Then your code for a command button might look
like:

Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.cboInvNum) Then
strWhere = strWhere & " And [INV#]=" & Me.cboInvNum
End If
DoCmd.OpenReport "rptOne", acPrint, , strWhere

You can add more "openreport" lines if you want.
 
J

jln via AccessMonster.com

I tried your code and didnt have much luck. I had tried using the combo box
before with mixed results. That why i was thinking more along the lines of
having the user hit a button and popup box would come up asking for the inv
number and that number would be used for each where condition. Im just not
sure how to code it.
 
D

Duane Hookom

I don't us "pop ups" and wouldn't expect my users to. "didnt have much luck"
doesn't tell us much.
It might help if you provided some actual field names and types.
 
J

jln via AccessMonster.com

What about using a text box rather then a combo box I want the user to enter
the investor number
the reports are all based on INV# with a where statement of [Please enter
investor Number]. This is how each query is set up and the reports are set to
go off of that.

So what im thinking is something like

Private Sub Command3_Click()
Dim INV As String ' holds the value in the text box
INV = Me.txtInvNo ' places the textbox value into the var
strWhere = "INV#" & INV 'Here is my problem not sure how to get the to
work
DoCmd.OpenReport "Rec", acNormal, , strWhere
End Sub


I need to add a msgbox for the user pushing the button when there is no value.
Is there a way to prevent printing if there is not data in the report?
 
D

Duane Hookom

How about downgrading your combo box to a text box and using:

Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.txtInvNo) Then
strWhere = strWhere & " And [INV#]=" & Me.txtInvNo
End If
DoCmd.OpenReport "rec", acPrint, , strWhere

You should consider NOT using symbols and spaces in your field names.
 
J

jln via AccessMonster.com

Using the code you gave me the parameter box is still poping up. I hate using
symbols but i have been told not to change headers.

Duane said:
How about downgrading your combo box to a text box and using:

Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.txtInvNo) Then
strWhere = strWhere & " And [INV#]=" & Me.txtInvNo
End If
DoCmd.OpenReport "rec", acPrint, , strWhere

You should consider NOT using symbols and spaces in your field names.
What about using a text box rather then a combo box I want the user to
enter
[quoted text clipped - 17 lines]
value.
Is there a way to prevent printing if there is not data in the report?
 
J

jln via AccessMonster.com

Using the code you gave me the parameter box is still poping up. I hate using
symbols but i have been told not to change headers.

Duane said:
How about downgrading your combo box to a text box and using:

Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.txtInvNo) Then
strWhere = strWhere & " And [INV#]=" & Me.txtInvNo
End If
DoCmd.OpenReport "rec", acPrint, , strWhere

You should consider NOT using symbols and spaces in your field names.
What about using a text box rather then a combo box I want the user to
enter
[quoted text clipped - 17 lines]
value.
Is there a way to prevent printing if there is not data in the report?
 
D

Duane Hookom

What parameter box is popping up. Did you remove the parameter prompt from
your query?

--
Duane Hookom
MS Access MVP

jln via AccessMonster.com said:
Using the code you gave me the parameter box is still poping up. I hate
using
symbols but i have been told not to change headers.

Duane said:
How about downgrading your combo box to a text box and using:

Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.txtInvNo) Then
strWhere = strWhere & " And [INV#]=" & Me.txtInvNo
End If
DoCmd.OpenReport "rec", acPrint, , strWhere

You should consider NOT using symbols and spaces in your field names.
What about using a text box rather then a combo box I want the user to
enter
[quoted text clipped - 17 lines]
value.
Is there a way to prevent printing if there is not data in the report?
 
J

jln via AccessMonster.com

The parameter box that come up say inv# which is not the same as i what i had
in the query. I double checked my query for anything in the where condition,
notthing there.

Duane said:
What parameter box is popping up. Did you remove the parameter prompt from
your query?
Using the code you gave me the parameter box is still poping up. I hate
using
[quoted text clipped - 15 lines]
 
D

Duane Hookom

Do you have a field in your report's record source named [INV#]?

--
Duane Hookom
MS Access MVP

jln via AccessMonster.com said:
The parameter box that come up say inv# which is not the same as i what i
had
in the query. I double checked my query for anything in the where
condition,
notthing there.

Duane said:
What parameter box is popping up. Did you remove the parameter prompt from
your query?
Using the code you gave me the parameter box is still poping up. I hate
using
[quoted text clipped - 15 lines]
value.
Is there a way to prevent printing if there is not data in the report?
 
J

jln via AccessMonster.com

NO. I change the name to match and i get a run time error unable to print you
object.

Duane said:
Do you have a field in your report's record source named [INV#]?
The parameter box that come up say inv# which is not the same as i what i
had
[quoted text clipped - 10 lines]
 
D

Duane Hookom

You need to understand that you can't use a where condition that is invalid.
Imagine a school bus full of 6-7 year olds. You are asked to unload the bus
and find all the kids with a red dot on their name tag. What happens if they
aren't wearing name tags?

I don't know what you changed or what you mean by "run time error unable to
print you object"

--
Duane Hookom
MS Access MVP


jln via AccessMonster.com said:
NO. I change the name to match and i get a run time error unable to print
you
object.

Duane said:
Do you have a field in your report's record source named [INV#]?
The parameter box that come up say inv# which is not the same as i what
i
had
[quoted text clipped - 10 lines]
value.
Is there a way to prevent printing if there is not data in the
report?
 
J

jln via AccessMonster.com

Im so sorry I Didnt mean to say no thanks. I ment to say so Thanks for the
Help..... Really sorry
 

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