Cmd Button open/link a form within a subform

Valery

Registered User.
Local time
Today, 15:45
Joined
Jun 22, 2013
Messages
363
Hi everyone!

I have a form: frmUnitUpd with a subform: frmUnitUpd_Parking based on tblParking.

In the subform, I have a command button to open a popup form called : frmUnitUpd_ParkingFees, based on tblParkingFees.

The Parking and the Parking Fees table are linked by : PkgID which is the primary key of the Parking table.

I have always used the following code but never for a "sub-sub form". Is there something I need to add?

The popup does open, saves the data but NOT leaves the PkgID blank, so no link to it's main form.

Code:
Private Sub cmdPkgFees_Click()
On Error GoTo Err_cmdPkgFees_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmUnitUpd_ParkingFees"

    stLinkCriteria = "[PkgID]=" & Me![PkgID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdPkgFees_Click:
    Exit Sub

Err_cmdPkgFees_Click:
    MsgBox Err.Description
    Resume Exit_cmdPkgFees_Click
End Sub

Really would appreciate some detailed help. THANK YOU.
 
If its a pop up, then it's not a sub-sub form.
You can just embed it in the sub form. No button/code needed.
 
You CAN make a pop up by calling the ID....

Docmd.openform "frmPopup",,,"[ID]=" & txtID
 
Hi,

Perhaps with my limited knowlege, I am not using the proper terminology. It is a continuous form, set to PopUp = Yes. I believe I cannot "imbed" the form as both the frmUnitUpd_Parking and frmUnitUpd_ParkingFees are continuous. So this is the reason I put a command button.

But, as I indicated, it does not "link". Just to ensure I understand - I should insert:

Docmd.openform "frmUnitUpd_ParkingFees",,,"[PkgID]="& PkgID

in an OnClick event procedure of the command button. How is this different than what I had? Please confirm.

Thank you.
 
Tried: Docmd.openform "frmUnitUpd_ParkingFees",,,"[PkgID]="& PkgID. Opens the form, does not enter the PkgID. Also ignores that the form is continuous despite having "Yes" to :
Control Box, Navigation buttons, Record Selector.

When I open the form - not using the command button - it looks fine.
 

Users who are viewing this thread

Back
Top Bottom