EternalMyrtle
I'm still alive
- Local time
- Yesterday, 23:49
- Joined
- May 10, 2013
- Messages
- 533
Hello,
I am using the following code I found to hide and show my subforms as the tab control pages are changed:
Basically, you remove the subform's source object and put the name into the tag property.
The code itself works great EXCEPT my subforms cannot be edited or allow new records when in use. The subforms' data properties are set to Allow Additions = Yes and Allow Edits = Yes.
Is there some way to use this code AND have subforms that can be edited and allow new records or is it a lost cause?
Is there a better way? Maybe doing the same with the subform's recordsource rather than using the source object property?
BTW, I am doing this to help with load times in subform-heavy forms. Also, I have been getting a "Cannot open anymore databases" error 3048 when several control-heavy forms are open at once. I was hoping this could help with that, too.
I hope someone can help. Thank you!!
I am using the following code I found to hide and show my subforms as the tab control pages are changed:
Code:
Private Sub TabControlMain_Change()
'Set the source object for the subforms as the tab control pages change. This should help to decrease load times on open
Dim pgn As Access.Page
For Each VarCtlSubform In Array(Me.subformProjectsBuildingTypes, Me.subformProjectsClients, Me.subformProjectsClientContacts, Me.subformProjectsConsultants, subformProjectsContacts)
Set pgn = VarCtlSubform.Parent
If pgn.PageIndex <> Me.TabControlMain.Value Then
If VarCtlSubform.SourceObject <> "" Then
VarCtlSubform.SourceObject = ""
End If
Else
If VarCtlSubform.SourceObject <> VarCtlSubform.Tag Then
VarCtlSubform.SourceObject = VarCtlSubform.Tag
End If
End If
Next
Basically, you remove the subform's source object and put the name into the tag property.
The code itself works great EXCEPT my subforms cannot be edited or allow new records when in use. The subforms' data properties are set to Allow Additions = Yes and Allow Edits = Yes.
Is there some way to use this code AND have subforms that can be edited and allow new records or is it a lost cause?
Is there a better way? Maybe doing the same with the subform's recordsource rather than using the source object property?
BTW, I am doing this to help with load times in subform-heavy forms. Also, I have been getting a "Cannot open anymore databases" error 3048 when several control-heavy forms are open at once. I was hoping this could help with that, too.
I hope someone can help. Thank you!!