E
enrico1982
I have created a button that opens a related record from a subform, like the
'See Product Details' button in the Access 2002 sample database 'orders'. My
difference is that the subform is connected to a union query and so the
related records are in a few forms. I was recently suggested this code. It
Looks like what i want to do but gets stuck on Me.RecordType. As i have
virtually no knoledge of basic i dont know what to do:
Private Sub ViewCurrentRecord_Click()
Dim strDocName As String
Dim strLinkCriteria As String
On Error GoTo ErrorHandler
Select Case Me.RecordType
Case "Fault Report": strDocName = "FaultReportForm"
Case "CD23": strDocName = "CD23"
Case "DA36": strDocName = "DA36"
End Select
strLinkCriteria = "[Date] = Forms!UnitData!UnitDataSubq!Date"
DoCmd.OpenForm strDocName, , , strLinkCriteria
End
Exit Sub
ErrorHandler:
MsgBox "Error#: " & Err.Number & vbCrLf & Err.Description
End Sub
Where RecordType is the field in the subform which determines what form
should be opened.
Thanks in advance
'See Product Details' button in the Access 2002 sample database 'orders'. My
difference is that the subform is connected to a union query and so the
related records are in a few forms. I was recently suggested this code. It
Looks like what i want to do but gets stuck on Me.RecordType. As i have
virtually no knoledge of basic i dont know what to do:
Private Sub ViewCurrentRecord_Click()
Dim strDocName As String
Dim strLinkCriteria As String
On Error GoTo ErrorHandler
Select Case Me.RecordType
Case "Fault Report": strDocName = "FaultReportForm"
Case "CD23": strDocName = "CD23"
Case "DA36": strDocName = "DA36"
End Select
strLinkCriteria = "[Date] = Forms!UnitData!UnitDataSubq!Date"
DoCmd.OpenForm strDocName, , , strLinkCriteria
End
Exit Sub
ErrorHandler:
MsgBox "Error#: " & Err.Number & vbCrLf & Err.Description
End Sub
Where RecordType is the field in the subform which determines what form
should be opened.
Thanks in advance