Access Macro Question

Let me preface this with I am relatively new to Access.  I have a data list with a customer number in it.  This number is of course unique to each customer.  My question is: how do I make that number a link to another form that will show the details for that customer?
Hamilj03Asked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
What do you mean by "link"? Do you want to open another form based on the selection in your "list of accounts? If so, you can use the Where argument of the OpenForm method:

DoCmd.OpenForm "YourForm", , , "YourCustomerField=" & Me.YourList.Column(0)
0
 
EirmanChief Operations ManagerCommented:
If you want to link a form to a table with a list of customers ... set the "record source" of the form to the table.

Even better would be to create a query based on the customers table and set the query as the "record source" of the form.
0
 
Hamilj03Author Commented:
I have done a query.  I have a form that has a list of accounts.  The first column in my list is the customer number.  I want this number to be a link to another form that will have the details of this customer.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Hamilj03Author Commented:
What does that mean?  Like I said, I am new to Access.
0
 
dqmqCommented:
On your main form add a subform control.  Make it a large rectangular box that is big enough to hold a second form that presents the details of the customer.  In the master/child property of the subform control, identify the fields that "link" the subform and the main form.

0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Again: What do you mean by "link"? Can you more clearly define what you want to do?

0
 
Hamilj03Author Commented:
Attached is a screenshot with the list in the background and the contact detail in the foreground.  when someone clicks on the blue link on the list, I want to open the contact detail form.  I am able to do this now.  However, it opens to the fist record instead of the specific record i clicked on.  How do I pass on the variable of Cust_No?
ScreenShot.png
0
 
dqmqConnect With a Mentor Commented:
LSM answered a couple frames back:

DoCmd.OpenForm "YourForm", , , "YourCustomerField=" & Me.YourList.Column(0)

But, you appear to be working off a datagrid (rather than a list), which makes it a little different.

DoCmd.OpenForm "YourForm", , , "CustNo=" & Me.CustNo

I can't see the full CustNo, so I am assuming it is numeric.  If not, the syntax changed a we bit to pick up the necessary quote marks:

DoCmd.OpenForm "YourForm", , , "CustNo=""" & Me.CustNo & """"


Having said that, I stiill prefer the master/child subform approach as it makes for a cleaner, more intuitive user interface, IMHO.

0
 
Hamilj03Author Commented:
Thanks for the help.  Works great.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.