A family of Microsoft relational database management systems designed for ease of use.
Change that to: "[CustNo]=" as per Scott's previous post.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
A family of Microsoft relational database management systems designed for ease of use.
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.
Change that to: "[CustNo]=" as per Scott's previous post.
Thank you for the advice. I am going to fiddle around and change the names of the report and Text 25 once I get this print thing going.
I changed the code to your suggestion but I am getting a Runtime error "3065" Syntax error (missing operator) in query expression "CustNo"=
Ok, change it to:
Private Sub Command21_Click()
DoCmd.OpenReport "CODE Q & J CREDITS Subreport", acViewPreview,,"[CustNo]=" & Text25
End Sub
That's all you needed. And frankly, I would NOT embed the subreports on the form. Since you are already opening the report in Print Preview then you are just adding unnecessary steps and wasting your users time.
Just let them enter CustNo and open the report.
As Ken is pointing out you don't even need the search button. The only purpose of the search button is to confirm the CustNo exists. But there is a better way. Use a Combobox to select the Customer by name. the combo box would have the following relevant properties:
Rowsource: "SELECT CustNo, Custname FROM tblCustomers ORDER BY Custname;
Bound column: 1
Column Count: 2
Column Widths: 0";2"
So then its impossible for them to select an invalid CustNo. In fact you can make this even shorter by using this code in the After Update event of the combo
DoCmd.OpenReport "CODE Q & J CREDITS Subreport", acViewPreview,,"[CustNo]=" & cboCustomer
By the way, its not good practice to use spaces or special characters in object names. this can come back to haunt you. I'm using cboCustomer as the name of the combox, you should select your actual controlname. But don't accept the default names (like Text25). When you go back to look at your code you aren't going to rememberer what Text25 is.
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.
What is the code or macro for the button's Click event? It will need to filter the report to the current customer by means of the OpenReport method's WhereCondition argument. Filtering the form does not per se filter the report.
Sorry I don't meant to dodge any questions, I am just so frustrated searching for days and trying so many different codes and none of them are working. I am sure it's a simple thing but for me apparently it's not. Any help and advice you can give would be greatly appreciated