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: Newest
  1. Anonymous
    2016-03-23T18:24:18+00:00

    Ok so I did exactly what you suggested and when I ran the command I got the same message. I changed the QNCLI to CustNo to see, and same error message saying syntax error (missing operator) "[QNCLI] ="

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,845 Reputation points Volunteer Moderator
    2016-03-22T19:41:02+00:00

    Alright lets start this from scratch. Create a new unbound form and put a text box and a button on it. Name the textbox txtCust and button cmdCredits.

    Behind the button put

    DoCmd.OpenReport "Credits",acViewPreview,,"[QNCLI] = " & Me.txtCust

    See if that works.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-03-22T19:30:38+00:00

    It's the same message, for some reason it's not recognizing the CustNo or QNCLI. I also renamed my report to "Credits' just to make it easier but still it's not working.

    Here is a print screen of my form in design view and it's the Command21 button on the report that I am trying to do. I would like to have a command button on all the reports on the form so that the users have a choice of which different reports they need to print as they may not need all of them. The print button on the form in Blue we need to delete

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,845 Reputation points Volunteer Moderator
    2016-03-22T18:22:26+00:00

    Are customer's individuals? In my company, customers are known more by their names than their numbers, but if you go by Account number, then it does make more sense to use that. Thous I would still use a combo so you are assured that they select a valid account number, and then you don't need to use code to verify it.

    We are having a problem here where you know your database and we don't. I can tell that the code:

    DoCmd.OpenReport "reportname",acViewPreview,,"[keyfield] = " & Me.keycontrol

    works. I use it all the time. But you have to use the correct report name, the correct name for the unique field in the recordsource of the report and the correct name for the control that contains the value you want to filter for.

    Now when you say "QNCLI isnt working either." you have to define how its not working. Are you getting the same message or a different one?

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2016-03-22T17:45:01+00:00

    Unfortunately searching by customer name wouldn't work because we have many customers with the same name and a lot of times customers do not provide their name on paperwork but only their account #'s. As well the tables we have are files imported from queries run from the As400 so that is why the names differ and relationships had to be made in access.

    The database works fine it does the job its meant to do for what we need it for except for when it comes to printing as stated. 

    Im sure its all in the expression and this is an area i am a complete novice in. 

    Changing CustNo to QNCLI isnt working either.

    Was this answer helpful?

    0 comments No comments