Command Button to Open Form and display specific records

Q

QS

Please help. When I click on my command button to open
up a form, it won't show specific records. It displays a
new form. On my form, it is not set to only allow new
additions. I don't know what else to do.

Example: (Two forms: customer and payments)

On the customer form, when you click on the payments
command button, it won't take you to the payments form to
show all the payments related to that specific customer.
It displays a blank payments form. How can I link it so
that when you do click on the payments button, you only
see those records related to that customer.

Thanks

(e-mail address removed)
 
P

PC Datasheet

<< When I click on my command button to open up a form, it won't show specific
records. >>

If your form is based on a query, check the query to be sure it is returning
records. Also check the Data Entry property under the Data tab in properties. It
should be set to No.

<< On the customer form, when you click on the payments command button, it
won't take you to the payments form to show all the payments related to that
specific customer. >>

Assuming your primary key in the Customers table is CustomerID and the foreign
key in the Payments table is CustomerID, put this code on the OnClick event of
the command button:

DoCmd.OpenForm "FrmPayments",,,"[CustomerID] = " & Me!CustomerID


--
PC Datasheet
A Resource for Access, Excel and Word Applications
(e-mail address removed)
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel
 
Joined
Sep 1, 2017
Messages
1
Reaction score
0
I want to use a button to enter specific records in a form. For Example I am making an overview form of Cars Stock. I will use buttons of names of cars, in this way the user can select the name of the car to view details on an other form. When a user clicks the button, he/She goes to that record which is located in another form.
Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top