[AccessD] JIT SubForms

jwcolby jwcolby at colbyconsulting.com
Tue Aug 28 18:59:23 CDT 2007


Bryan,

This is the code from C2DbFW3G.  It doesn't appear that I am seeing errors
on the bind side.  On the unbind side I have an error case 2101 which I have
not commented as to what it is.  I will look back at the older framework to
see how I handled it there as well.

Function Bind(Optional lstrLinkChildFields As Variant = "", _
                Optional lstrLinkMasterFields As Variant = "", _
                Optional lstrSrcObject As Variant = "")
On Error GoTo Err_Bind
Dim lfrm As Form
    If Not IsEmpty(lstrLinkChildFields) Then
        mstrLinkChildFields = lstrLinkChildFields
    End If
    If Not IsEmpty(lstrLinkMasterFields) Then
        mstrLinkMasterFields = lstrLinkMasterFields
    End If
    If Not IsEmpty(lstrSrcObject) Then
        mstrSourceObject = lstrSrcObject
    End If
    With mctlSFrm
        .LinkChildFields = mstrLinkChildFields
        .LinkMasterFields = mstrLinkMasterFields
        .SourceObject = mstrSourceObject
        On Error Resume Next
        Set lfrm = mctlSFrm.Form
        Set mSubFormClass = lfrm.fclsfrm
        Set lfrm = Nothing
    End With
Exit_Bind:
Exit Function
Err_Bind:
        MsgBox Err.Description, , "Error in Function dclsCtlSFrm.Bind"
        Resume Exit_Bind
    Resume 0    '.FOR TROUBLESHOOTING
End Function

'
'Unbinds the subform from the subform control for JIT subforms
'
'The SourceObject needs to be cleared first since a Current event will run
for each Link you clear
'if the SourceObject is still set
'
Function UnBind()
On Error GoTo Err_UnBind
    If mctlSFrm.SourceObject <> "" Then
        'Debug.Print mctlSFrm.Name & " is unbinding"
        assDebugPrint mctlSFrm.name & ":UnBind:" & mctlSFrm.SourceObject,
DebugPrint
'        If Len(mctlSFrm.Form.RecordSource) = 0 Then
'        End If
'        On Error Resume Next
        If mblnJITSFrmUnload Then
            mfrm.fclsfrm.Unbinding = True
            'cleanup pointer to the subform's class
            mSubFormClass.mTerm
            Set mSubFormClass = Nothing
            mctlSFrm.SourceObject = ""
            mfrm.RecordSource = ""
            mctlSFrm.LinkChildFields = ""
            mctlSFrm.LinkMasterFields = ""
        End If
    End If
Exit_UnBind:
    On Error Resume Next
Exit Function
Err_UnBind:
    Select Case Err
    Case 2101
        Resume Next
    Case Else
        MsgBox Err.Description, , "Error in Function dclsCtlSFrm.UnBind"
        Resume Exit_UnBind
    End Select
    Resume 0    '.FOR TROUBLESHOOTING
End Function 


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell
Sent: Tuesday, August 28, 2007 4:33 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] JIT SubForms

On 8/28/07, jwcolby <jwcolby at colbyconsulting.com> wrote:
> I'll go find the code in my framework.  I don't actually use it in 
> this manner though.  I usually set the links then clear and load the 
> source object.  I think I remember having to save the link data, set 
> all to "" and then set all three of them again.
>
> I can't find the source until after I cook dinner and take my son to 
> his Karate class though so it will be this evening.

Ah, the joys of being at home with the kids. Gotta love it!!!

No rush. This project isn't going anywhere fast. My brain ain't working too
well these days :)

--
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well preserved
body, but rather to skid in sideways, totally worn out, shouting "What a
great ride!"
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list