Stephanie T.
Registered User.
- Local time
- Today, 09:00
- Joined
- Jun 20, 2002
- Messages
- 60
I have a form that has two subforms. One is part of the regular form and works just fine, relating to the form as a subform. That is, once the information has been entered it is saved both in the form and the related table. The table for the subform automatically enters the related field information from the main form. For example, the main form is for the Broker Company, the subform is for the individual Field Reps. When the data entry person enters the Field Rep information, she does not need to also enter the (redundant) Broker Company info, that is automatically entered into the table - i.e. the two forms are relating properly.
I want to add a button to open the second subform and have it relate to the main form the same way that the first subform relates. Here is the code that I have been using (thank you for help from this group so far):
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProductBrokerSynch"
stLinkCriteria = "[ProductBrokerSynch]=" & "'" & Me![ProductName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnBrokerProducts_Click:
Exit Sub
Err_btnBrokerProducts_Click:
MsgBox Err.Description
Resume Exit_btnBrokerProducts_Click
It looks like there is an error, but I don't know enough VBA to understand it. This has sort of worked, I could get the form, and enter the data, it went into the table, but A) it didn't save to the form and B) it still is not relating to the main form like a subform (i.e. entering the redundant date into the table). So, that if I want the Broker Company information I would need to have that as a field in this subform.
Any help would be greatly appreciated.
Thank you,
Stephanie
I want to add a button to open the second subform and have it relate to the main form the same way that the first subform relates. Here is the code that I have been using (thank you for help from this group so far):
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProductBrokerSynch"
stLinkCriteria = "[ProductBrokerSynch]=" & "'" & Me![ProductName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnBrokerProducts_Click:
Exit Sub
Err_btnBrokerProducts_Click:
MsgBox Err.Description
Resume Exit_btnBrokerProducts_Click
It looks like there is an error, but I don't know enough VBA to understand it. This has sort of worked, I could get the form, and enter the data, it went into the table, but A) it didn't save to the form and B) it still is not relating to the main form like a subform (i.e. entering the redundant date into the table). So, that if I want the Broker Company information I would need to have that as a field in this subform.
Any help would be greatly appreciated.
Thank you,
Stephanie