Printing Subreports

Anonymous
2016-03-21T14:14:02+00:00

Hi, I have created a form in access 2010 called "customer profile" on the form I have 2 reports that I created and dragged  onto the form "Credits" and "Denials"

On my 'customer profile' form I have a search button where when we enter the customer number of a client the information regarding that specific client populates on the (subreports) on the form 'Credits and Denials'.

When we go to print the reports for the specific customer the criteria changes and ALL customers start to print rather than the specific customer we searched for.

How can we fix this, please help

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

42 answers

Sort by: Most helpful
  1. Anonymous
    2016-03-21T19:08:59+00:00

    The reason I have a button to open the report is just to view the print set up and from there we would print it.

    The code to open the report is:

    Private Sub Command21_Click()

    DoCmd.OpenReport "CODE Q & J CREDITS Subreport", acViewPreview

    End Sub

    The code for my search button on the form is:

    Private Sub Command27_Click()

    If IsNull(Text25) = False Then

    Me.Recordset.FindFirst "[CustNo]=" & Text25

    Me!Text25 = Null

    If Me.Recordset.NoMatch Then

    MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"

    Me!Text01 = Null

    End If

    End If

    End Sub

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,845 Reputation points Volunteer Moderator
    2016-03-21T18:45:24+00:00

    The reason the reports are embedded on the form is so that the user can view the information on the screen first before deciding to print it as they may not need to actually print it.

    So you open the report in Print Preview mode or Report view so they can decide whether to actually print it or not.

    Most users here do not have a clue how to make queries or filter data so that is why we created this dbase so that all the information pops up once you enter the customer #.

    Which is fine. I'm not saying you need to change that at all. I do almost the same thing, except I open the report in Print Preview or Report view once they select the Customer. When the report is opened in Print Preview the ribbon changes where they can select to print, send to PDF etc. If I use Report view I'll have a print button on the report.

    I do not have a print button, I just have a simple command button on the report to open it to view. it 

    However when we click the button to view the report the information changes and all customers are captured and not the specific customer we searched for.

    What button to view the report? Are you saying that after they preview the report on the form you then open the report in Print Preview? Isn't that a redundant step? So what is the code behind THAT button?

    My dilemma is with the code, I am not an expert with writing codes etc. and I have tried many different suggestions given from googling this problem but haven't found one that works for me, where

    when we click the command button to view the report that that current customers information is there.

    I can tell you how to write the code generally, but if you show me the code you are using, I can tell you how to modify it so it does what you want. Both Don and I had given you different ways to do what you want in our initial responses. But if you want an exact answer we need to see the code you are currently using. Reports don't open on their own. Either you select the report from the Nav pane or you have a code behind a control that triggers the report. I'm trying to help you here, but you keep dodging the question I need an answer to to provide that help.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-03-21T18:31:39+00:00

    The reason the reports are embedded on the form is so that the user can view the information on the screen first before deciding to print it as they may not need to actually print it.

    Most users here do not have a clue how to make queries or filter data so that is why we created this dbase so that all the information pops up once you enter the customer #.

    I do not have a print button, I just have a simple command button on the report to open it to view. it 

    However when we click the button to view the report the information changes and all customers are captured and not the specific customer we searched for.

    My dilemma is with the code, I am not an expert with writing codes etc. and I have tried many different suggestions given from googling this problem but haven't found one that works for me, where

    when we click the command button to view the report that that current customers information is there.

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,845 Reputation points Volunteer Moderator
    2016-03-21T17:36:27+00:00

    The idea is to have a database with the reports already there on the form for users to print. The information they need is filtered by simply inputting the customer number

    and when the reports populate with the information they can click a button and have the subreports print. However i cant 

    get them to print filtered with just the selected customer, when we print all customers print off. 

    Of course it is. And generally you put controls on a form to trigger the report printing. So you are triggering the report printing from a button? Then what is the code behind that button? If you show us that we can show you how to filter the report.

    Forms and reports display data differently. Again Reports were designed to be printed, Forms were not. If you prefer to display the related data using a report embedded on form, that certainly is a matter of personal preference. In 20 years of helping people use Access, I don't recall anyone else having that preference. If I wanted to display a report filtered for a selected client, I wouldn't embed the reports on a form. I would have a form where I select the client with a button to print the report. The code behind that button would use the WHERE clause of the OpenReport method (Action if you are using macros) to filter the report for the selected client.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2016-03-21T17:21:30+00:00

    What difference does it make putting reports on a form vs subdorm or queries? I think its all about preference

    Was this answer helpful?

    0 comments No comments