M
Michael Banks
I am trying to just make a short cut in my code so that I don't have to
reference frm's and subfrm's over and over again.
I have created a public control called stDocFrm and stDocSubfrm as
Control. I then pass this control up into a public funtion and perform
several tasks on it (do a recordsetclone.recordcount, set it visible,
move focus, etc.)
Here is the code:
Public stDocName As String
Public stDocFrm As Control
Public stDocSubfrm As Control
Private Sub cmdTransformers_Click()
On Error GoTo Err_cmdTransformers_Click
stDocName = "frmTransformers"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocFrm = Forms!frmtransformers <---Errors out here "Object
Variable or With block variable not set"
stDocSubfrm = Forms!frmtransformers!subfrmTransformers
Call EquipmentCountSub
Exit_cmdTransformers_Click:
Exit Sub
Err_cmdTransformers_Click:
MsgBox Err.Description
Resume Exit_cmdTransformers_Click
End Sub
Please offer up any opinions you have. Thanks
Mike
reference frm's and subfrm's over and over again.
I have created a public control called stDocFrm and stDocSubfrm as
Control. I then pass this control up into a public funtion and perform
several tasks on it (do a recordsetclone.recordcount, set it visible,
move focus, etc.)
Here is the code:
Public stDocName As String
Public stDocFrm As Control
Public stDocSubfrm As Control
Private Sub cmdTransformers_Click()
On Error GoTo Err_cmdTransformers_Click
stDocName = "frmTransformers"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocFrm = Forms!frmtransformers <---Errors out here "Object
Variable or With block variable not set"
stDocSubfrm = Forms!frmtransformers!subfrmTransformers
Call EquipmentCountSub
Exit_cmdTransformers_Click:
Exit Sub
Err_cmdTransformers_Click:
MsgBox Err.Description
Resume Exit_cmdTransformers_Click
End Sub
Please offer up any opinions you have. Thanks
Mike