Subform disappears if there is no data (1 Viewer)

magster06

Registered User.
Local time
Today, 01:20
Joined
Sep 22, 2012
Messages
235
Hello all,

I am using Access 2010.

I know this has been asked before, but I could not find a solution to my problem.

Whenever I come to a record that does not have any data in my subforms, then (as you can expect) my subform controls disappear.

My subforms have "Allow Additions" set to YES.

The subform tables are linked through a LEFT JOIN.

I would like the controls to stay visible even when there are no records in the subforms.

I tried to set the subforms ID to the main forms ID thinking that this will at least generate an autonumber to make the subforms controls visible, but it did not work

=[Forms]![frmCandidateInfo]![CandidateID].[Value]

Any help would be greatly appreciated!
 

magster06

Registered User.
Local time
Today, 01:20
Joined
Sep 22, 2012
Messages
235
Ok, I just realized that the disable code I am using is causing the issue (Allen Brownes code). I am using his code because it allows me to keep my combo box active so that I can search through the records.

Does anyone know of a work around?

Code:
Case acSubform
            'Recursive call to handle all subforms.
            bSkip = False
            For lngI = LBound(avarExceptionList) To UBound(avarExceptionList)
                If avarExceptionList(lngI) = ctl.Name Then
                    bSkip = True
                    Exit For
                End If
            Next
            If Not bSkip Then
                If Len(Nz(ctl.SourceObject, vbNullString)) > 0 Then
                    ctl.Form.AllowDeletions = Not bLock
                   [COLOR=yellow] [/COLOR][COLOR=red]ctl.Form.AllowAdditions = Not bLock 'this is the culprit
[/COLOR]                    
                    Call LockBoundControls(ctl.Form, bLock)
                End If
            End If
 
Last edited:

magster06

Registered User.
Local time
Today, 01:20
Joined
Sep 22, 2012
Messages
235
I guess I posted to early, sorry for the thread.

I just changed the following and now the subforms shows the controls and are still locked.

Case acSubform
'Recursive call to handle all subforms.
bSkip = False
For lngI = LBound(avarExceptionList) To UBound(avarExceptionList)
If avarExceptionList(lngI) = ctl.Name Then
bSkip = True
Exit For
End If
Next
If Not bSkip Then
If Len(Nz(ctl.SourceObject, vbNullString)) > 0 Then
ctl.Form.AllowDeletions = Not bLock 'removed this line
ctl.Form.AllowAdditions = Not bLock 'removed this line
ctl.Locked = True 'Added this line
Call LockBoundControls(ctl.Form, bLock)
End If
End If
 

Users who are viewing this thread

Top Bottom