Two Forms and One Button

phillbaker

Registered User.
Local time
Today, 14:40
Joined
Jun 29, 2008
Messages
45
I have two forms lets call them Form A which has my clients in, and form B which is going to show the payments made by those clients.

how do i link them together so when im on form A say looking at client 1's details i can click on a button and then it will show Form B with only the payments he has made.

i hope you can help.
 
Colin is spot on! This is the classic situation for the use of a form/subform!
 
Re: Subform

I would use a subform but there isnt anywhere else on the first form to put a subform thats why i want to use a button so it will open up a second form but still be relateing to the record i have just come froml.
 
Easiest way to prototype this is to use the form wizard, select the two tables/queries that represent your data, select "use another form", and then manipulate it the way you need. You can use the wizard generated set or you can cut and paste as needed from the wizard generated set into your design. Either way, you'll save hours.
 
To open another form with only the payments that person has made would be:

DoCmd.OpenForm "YourPaymentsForm", acNormal, , "[YourClientIDFieldHere]=" & Me!YourClientIDFieldOnFormAHere

This will open the form and filter only the payments for that person's ID.
 
Re: Code

with this code below :

DoCmd.OpenForm "YourPaymentsForm", acNormal, , "[YourClientIDFieldHere]=" & Me!YourClientIDFieldOnFormAHere

can both fields be called clientid or do they need to have seperate names. I tried this before and had them set both with the same field name is this where its getting confused?

as a field in both tables called clientid on a one to many relationship.
 
YourClientIDFieldHere is the name of the field in the form you are opening that is the ID of the client.

YourClientIDFieldOnFormAHere is the name of the field that would be matching to the ID field on the form B you are opening. They do not have to be the same name, but they do have to be the ID field which links them together.
 

Users who are viewing this thread

Back
Top Bottom