Command Button on SubForm Not Working on Main Form (1 Viewer)

jwal

Registered User.
Local time
Today, 12:12
Joined
Dec 1, 2015
Messages
13
Hello.
I have a main form (Form 1) that includes (2) subforms (Subform 1 and Subform 2). Subform 2 has a command button that opens PopForm 1 as a popup (VBA with use of OpenArgs). When Subform 2 is opened directly as the only form then the command button functions properly. When Subform 2 is opened as part of Form 1 and I click on the command button, I get "2450: cannot find the referenced form '.....'." Could someone please help me? :confused: :banghead: TIA.
 

June7

AWF VIP
Local time
Today, 08:12
Joined
Mar 9, 2014
Messages
5,423
Post code for analysis.

Code that is designed to work when form is opened independently won't always work when used as a subform because it is then not an open form, it is the SourceObject of a subform container.
 

jwal

Registered User.
Local time
Today, 12:12
Joined
Dec 1, 2015
Messages
13
Code:
Sub Form 2
Public Sub cmdReassign_Click()

    strOpenArgs = Me.txtToolGroupID & "," & Me.txtEmployee_Name
    DoCmd.OpenForm "popfrmReassignGroupedTools", , , "ToolGroupID=" & Me.txtToolGroupID, , acWindowNormal, strOpenArgs


PopForm 1

Private Sub Form_Open(Cancel As Integer)
    
    If Not IsNull(Me.OpenArgs) Then
        
        Me.txtToolCategoryQty = Forms!subfrmToolReassignment_Grouped.txtToolCategoryQty
        Me.txtToolLocation = Forms!subfrmToolReassignment_Grouped.[txtEmployee Name]
        
    End If
 
Last edited:

Users who are viewing this thread

Top Bottom