Hi
Access 2007 .mdb file - Split FE/BE
Can anyone tell me the correct (reliable) sequence for the opening of mainform/subforms?I have been plagued by problems for months. My Forms as ADODB RS based.
As we know, opening a main form automatically fires the opening of the subforms first. In the Open event of the subforms I build an SQL String and apply it to the respective subform's .Source param.. e.g. as below.
When the main form Open event fires, I similarly build an SQL string and use it in the .Source parm. BUT... at the point at which I set the mainform's RS (i.e. Set Me.Form.Recordset = Frm_RstADO), Access unloads all the Subforms... and leaves them closed so that all subsequent references to them fails!?! In fact, if I try to force open the subform with
Call Subform_Control.Form.Form_Open(0)
It crashes cos' there's an invalid property reference to form/report....
Any idea how I can open these to open reliably please?
Access 2007 .mdb file - Split FE/BE
Can anyone tell me the correct (reliable) sequence for the opening of mainform/subforms?I have been plagued by problems for months. My Forms as ADODB RS based.
As we know, opening a main form automatically fires the opening of the subforms first. In the Open event of the subforms I build an SQL String and apply it to the respective subform's .Source param.. e.g. as below.
Code:
Public Frm_CnnADO As ADODB.Connection
Public Frm_RstADO As ADODB.Recordset
Public Sub Form_Open(Cancel As Integer)
Dim SQLLine As String
SQLLine = "SELECT * FROM xyz WHERE " blah blah
Set Frm_CnnADO = CurrentProject.AccessConnection
Set Frm_RstADO = New ADODB.Recordset
With Frm_RstADO
Set .ActiveConnection = Frm_CnnADO
.Source = SQLLine
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.Open
End With
Set Me.Form.Recordset = Frm_RstADO
Set Frm_RstADO = Nothing
Set Frm_CnnADO = Nothing
When the main form Open event fires, I similarly build an SQL string and use it in the .Source parm. BUT... at the point at which I set the mainform's RS (i.e. Set Me.Form.Recordset = Frm_RstADO), Access unloads all the Subforms... and leaves them closed so that all subsequent references to them fails!?! In fact, if I try to force open the subform with
Call Subform_Control.Form.Form_Open(0)
It crashes cos' there's an invalid property reference to form/report....
Any idea how I can open these to open reliably please?