Need Form to Link to Subform Somehow... (1 Viewer)

accessingaccess

Registered User.
Local time
Today, 08:27
Joined
Mar 2, 2019
Messages
11
I have a form where users can view and edit client information. I also have a subform (subform1) that displays how much store credit the client currently has. I also have a subform (subform2) that displays client purchase history that I would like to only be visible if the user needs to see it.
I am envisioning a button the user can click that will take them either to a separate form or table that shows subform 2 for only the client whose information they were just viewing. Is this possible? So far I have only been able to figure out how to link to a table that displays all client history, but I need it to only show the history of the client whose page we are viewing.
Thank you!!
 

isladogs

MVP / VIP
Local time
Today, 16:27
Joined
Jan 14, 2017
Messages
18,213
Yes its certainly possible. If you have two separate subforms, just link the main form and subform2 using the common primary key field e.g. ClientID.
Or if you have nested subforms, do the same but linking subforms 1 and 2
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:27
Joined
May 21, 2018
Messages
8,527
You can also pop open a form with the client history. Using the wherecondition argument

https://docs.microsoft.com/en-us/office/vba/api/access.docmd.openform

Code:
Private Sub cmdHistory_Click()
    DoCmd.OpenForm "frmClientHistory", , , "ClientID=" & Me.clientID
End Sub

Never let users go directly to tables. Put them in some kind of view.
 

Users who are viewing this thread

Top Bottom