-
Open a SubForm to display required data
Hi All,
Best wishes for the New Year.
I've reached my limit on Access again!
I have a form ?Companies? which contains 2 subforms
Contact_SubForm
subContact
subContact is used as a ?lookup? and from a button on this form I want to open the record for the Company and the Contact. The record for the company on ?Companies? is opened by the code below. What I need help with is opening the subform to the correct record with the Contact details. The field Contact_No is used on Companies and Contact_Subform to link these, and on subContact to be used in the code.
[VBA]
Private Sub CommandShowDetail_Click()
On Error GoTo Err_CommandShowDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Companies"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Parent!CommandCloseForm.Visible = True
Exit_CommandShowDetail_Click:
Exit Sub
Err_CommandShowDetail_Click:
MsgBox Err.Description
Resume Exit_CommandShowDetail_Click
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Y'know Malc, I'm not entirely sure this belongs in the Outlook forum
K :-)
-
Ok I'm still in Happy Holiday mode! (Moved)
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules