Dynamic Subform (1 Viewer)

f9073341

Registered User.
Local time
Today, 07:36
Joined
Mar 7, 2009
Messages
27
Is it possible to update the "Source Object" of a subform dynamically?

I'm using the below code to open an "edit" form based on a double click in some filtered results. I want to display the form that opens as the source object of a subform, is that possible?

Code:
Private Sub Detail_DblClick(passToDetail As Integer)
 
    If IsNumeric(Me!txtDocID) Then
        DoCmd.OpenForm "frmEditDocument", acNormal, , "Document_ID=" & Me!txtDocID, acFormReadOnly, acHidden
    End If

Many Thanks
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:36
Joined
Sep 12, 2006
Messages
15,701
this sort of syntax

this one picks a different subform
me.subdetails!recordsource =

this one changes the query driving the current subform
me.subdetails!sourceobject =

might be dots, not bangs, and syntax may be off slightrly also - definitely doable

note - subdetails is the name of the subform control in the main form - although you can explicitly reference the form in a longer syntax
 

Thinh

Registered User.
Local time
Yesterday, 23:36
Joined
Dec 20, 2006
Messages
114
It is doable as i do this all the time with my application. I like the frame concept as it allow the user a clearer transition between the function.
Here is a sample code i use in my application.

SubMenu is the subform control
SourceObject is usually another form, i don't know if could be a query


The actual form name is hard code into the Active Control tag line.

Me.SubMenu.SourceObject = Me("opt" & Me.ActiveControl).Tag
 

Users who are viewing this thread

Top Bottom