mtevans
09-12-2008, 12:14 PM
Hi,
I have a main form (mainfrm1) with a button that calls another main form (Mainfrm2)that contains a subform. The values on the mainfrm1 are assigned to the controls in the subform of the mainfrm2.
The code runs on the click event of the button in mainfrm1. I am getting an error that the subform is not being recognized when the mainfrm2 is being called. This code worked before I made the subform a subform and was calling it directly. Since I added in the mainfrm2 level it now throws the error.
Any help would be greatly appreciated.
thanks,
Maureen
Private Sub OldMerchant_Click()
On Error GoTo Err_OldMerchant_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim tmpDba As Variant
Dim tmpMID As Variant
Dim tmpFirstName As Variant
Dim tmpLastName As Variant
Dim tmpPhone As Variant
Dim tmpEmail As Variant
Dim tmpPrin As Variant
Dim tmpAssoc As Variant
Dim tmpChain As Variant
stDocName = "mainfrm2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
' assign variables
tmpDba = Forms!MerchantLU!MerchantName
tmpMID = Forms!MerchantLU!MerchantIDLU
tmpPhone = Forms!MerchantLU!Phone
tmpEmail = Forms!MerchantLU!Email
tmpPrin = Forms!MerchantLU!Principal
tmpAssoc = Forms!MerchantLU!Associate
tmpChain = Forms!MerchantLU!Chain
Forms!mainfrm2!GAAOrderFormDE.Form.DBAName = tmpDba
Forms!mainfrm2!GAAOrderFormDE.Form.MerchantNumber = tmpMID
Forms!mainfrm2!GAAOrderFormDE.Form.ContactPhone = tmpPhone
Forms!mainfrm2!GAAOrderFormDE.Form.Email = tmpEmail
Forms!mainfrm2!GAAOrderFormDE.Form.Prin = tmpPrin
Forms!mainfrm2!GAAOrderFormDE.Form.Assoc = tmpAssoc
Forms!mainfrm2!GAAOrderFormDE.Form.Chain = tmpChain
Exit_OldMerchant_Click:
Exit Sub
Err_OldMerchant_Click:
MsgBox Err.Description
Resume Exit_OldMerchant_Click
End Sub
I have a main form (mainfrm1) with a button that calls another main form (Mainfrm2)that contains a subform. The values on the mainfrm1 are assigned to the controls in the subform of the mainfrm2.
The code runs on the click event of the button in mainfrm1. I am getting an error that the subform is not being recognized when the mainfrm2 is being called. This code worked before I made the subform a subform and was calling it directly. Since I added in the mainfrm2 level it now throws the error.
Any help would be greatly appreciated.
thanks,
Maureen
Private Sub OldMerchant_Click()
On Error GoTo Err_OldMerchant_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim tmpDba As Variant
Dim tmpMID As Variant
Dim tmpFirstName As Variant
Dim tmpLastName As Variant
Dim tmpPhone As Variant
Dim tmpEmail As Variant
Dim tmpPrin As Variant
Dim tmpAssoc As Variant
Dim tmpChain As Variant
stDocName = "mainfrm2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
' assign variables
tmpDba = Forms!MerchantLU!MerchantName
tmpMID = Forms!MerchantLU!MerchantIDLU
tmpPhone = Forms!MerchantLU!Phone
tmpEmail = Forms!MerchantLU!Email
tmpPrin = Forms!MerchantLU!Principal
tmpAssoc = Forms!MerchantLU!Associate
tmpChain = Forms!MerchantLU!Chain
Forms!mainfrm2!GAAOrderFormDE.Form.DBAName = tmpDba
Forms!mainfrm2!GAAOrderFormDE.Form.MerchantNumber = tmpMID
Forms!mainfrm2!GAAOrderFormDE.Form.ContactPhone = tmpPhone
Forms!mainfrm2!GAAOrderFormDE.Form.Email = tmpEmail
Forms!mainfrm2!GAAOrderFormDE.Form.Prin = tmpPrin
Forms!mainfrm2!GAAOrderFormDE.Form.Assoc = tmpAssoc
Forms!mainfrm2!GAAOrderFormDE.Form.Chain = tmpChain
Exit_OldMerchant_Click:
Exit Sub
Err_OldMerchant_Click:
MsgBox Err.Description
Resume Exit_OldMerchant_Click
End Sub