2021-01-29

Access - How to link dynamically loaded unbounded subforms to main form?

New to access and vba.

I have a bound main form (FormA) with a combobox on it and two unbound subforms (subfrmA & subfrmB). (Both forms are attached to a table however I want them to load onto the main form where I placed an unbound subform as a placeholder)

The combobox has two values “a” and “b.” When a is selected I want subfrm A to load onto Form A. When b is selected I want subfrmB to load onto Form A. — So far I think have this part working

However when I select a record on the main form the associated subforms doesn’t appear. When I try to link the subforms to the main form an error message appears saying I can’t build a link between unbound forms.

The packageID is the link between the main form and subform snd is a hidden field on all forms. Whenever the packageID is automatically updated the psckageID in the subform fields are also updated.

form design view

Case”A”                  
            Me.subfrmAB.SourceObject=“FormA
            Me.packageDetailsID=Me.subfrmAB.packageDetailsID
Case “B”

                                                              
            Me.subfrmAB.SourceObject=“FormB”
            Me.packageDetailsID=Me.subfrmAB.packageDetailsID


from Recent Questions - Stack Overflow https://ift.tt/3psJR6F
https://ift.tt/3r5dP0T

No comments:

Post a Comment