• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

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?
0
Hamilj03
Asked:
Hamilj03
  • 4
  • 2
  • 2
  • +1
2 Solutions
 
EirmanCommented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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
 
dqmqCommented:
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now