I’m using Access 2K on XP Professional with reference to DAO 2.5/3.5 Compatibility library
I have been trying to find a way to go to a record on one subform with a button click from a subform, nested within it
There is a main form with company details, subfrom A with employee contact details and subform B, nested in subform A, which shows all the contacts for the company.
What I would like to do is to either set up the onclick event for the contacts name or a button that goes to the employees details in subfrom A.
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "subformA"
stLinkCriteria = "[contactID]=" & Me![contactID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub
I have used the wizard to open a form and goto the record that matches the contactID record selected in sub form B and have edited it to reflect mainform, subforms A & B etc, but have been unable to get it to work.
Any thoughts would be useful. I haven’t done a lot of coding in Access and tend to edit code created by wizards.
Regards
Philip
I have been trying to find a way to go to a record on one subform with a button click from a subform, nested within it
There is a main form with company details, subfrom A with employee contact details and subform B, nested in subform A, which shows all the contacts for the company.
What I would like to do is to either set up the onclick event for the contacts name or a button that goes to the employees details in subfrom A.
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "subformA"
stLinkCriteria = "[contactID]=" & Me![contactID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub
I have used the wizard to open a form and goto the record that matches the contactID record selected in sub form B and have edited it to reflect mainform, subforms A & B etc, but have been unable to get it to work.
Any thoughts would be useful. I haven’t done a lot of coding in Access and tend to edit code created by wizards.
Regards
Philip