FYI, "Name" is a reserved word in Access and shouldn't be used for object names.
Here is a list of reserved words:
http://allenbrowne.com/AppIssueBadWord.html
The customer name is also a bad choice to use to select customers - what happens when you have two customers named "John Smith"?
Actually, you should have (at least) two fields for the customer name - FName and LName. It is easier to combine the names than split one field into First and Last names.
.
A better field for selecting a customer would be the cust_ID field. The SQL would look something like:
Code:
SELECT customer.cust_ID, customer.cust_name, assets.asset_id, assets.asset_location
FROM customer INNER JOIN assets
WHERE customer.cust_ID = 2;
Yes it is hard to know that Customer A's ID is 2.
So create a form, add a combo box and a button.
Let's name:
the form "frmSelect"
the combo box "cboCustomer"
the button "cmdPreview"
The recordsource for the combo box "cboCustomer" would be
Code:
SELECT customer.cust_ID, customer.cust_name
FROM customer
ORDER BY customer.cust_name
Set the column count to 2
Set the column widths to 0,2
The code behind the button for the click event would be something like:
(to preview)
Code:
Private Sub cmdPreview_Click()
Dim stDocName As String
stDocName = "Report1"
DoCmd.OpenReport stDocName, acPreview
End Sub
Change the report name (in red) to your report name.
Edit the report query to look like: (plus other columns)
Code:
SELECT customer.cust_ID, customer.cust_name, assets.asset_id, assets.asset_location
FROM customer INNER JOIN assets
WHERE customer.cust_ID = [forms]![frmSelect].[cboCustomer];
Open the form "frmSelect", select a customer using the combo box and click the button to view the report.
Close the report, select a different customer and click the button.
This is the basic method to select and view/print a customer.