O
oldblindpew
I'm trying to create a function that will open a detail form based on a field
value in a master form. I can do this using a private sub, but I hate
replicating the same private sub over and over again each time I want to
drill down from a different form or control. I also like being able to run a
function directly from the On Double Click event of any given control and
form without first having to go to a private sub.
The function would have to be told the name of the detail form to open, the
name of the key field in the detail form, and the value to search for.
Here's the event and the function that don't work:
=Drilldown("formInsPolGL",[GLpolID],"[PolicyID]=" & [Me].[GLpolID])
Function Drilldown(strFormName As String, FieldValue As Long, strWhereCond
As String)
If IsNull(FieldValue) Then
GoTo Exit_Drilldown
End If
DoCmd.OpenForm strFormName, strWhereCond
Exit_Drilldown:
On Error Resume Next
Exit Function
End Function
I apoligize for having to ask for help on what should be such a simple bit
of programming.
Thanks,
oldblindpew
value in a master form. I can do this using a private sub, but I hate
replicating the same private sub over and over again each time I want to
drill down from a different form or control. I also like being able to run a
function directly from the On Double Click event of any given control and
form without first having to go to a private sub.
The function would have to be told the name of the detail form to open, the
name of the key field in the detail form, and the value to search for.
Here's the event and the function that don't work:
=Drilldown("formInsPolGL",[GLpolID],"[PolicyID]=" & [Me].[GLpolID])
Function Drilldown(strFormName As String, FieldValue As Long, strWhereCond
As String)
If IsNull(FieldValue) Then
GoTo Exit_Drilldown
End If
DoCmd.OpenForm strFormName, strWhereCond
Exit_Drilldown:
On Error Resume Next
Exit Function
End Function
I apoligize for having to ask for help on what should be such a simple bit
of programming.
Thanks,
oldblindpew