Hi,
I'm trying to work out how to fix an error, but can't quite get my head around loading recordsets. Any assistance would be appreciated.
I have a button on the switchboard to "Add New Invoice". When pressed this opens "frm_MainInput" and hides navigation buttons :
The frm_MainInput form has a tab control with threes subforms (Datasheet view) : frm_MainInputSub, frm_CommissionSub and frm_DebtSub.
Each record in MainInput can have several rows saved in MainInputSub (line items on an invoice). but when I run the above code and select any field in the MainInputSub I get the error :
You entered an expression that has an invalid reference to the property Form/Report
From my research I believe it is because the recordset of the subform (s?) has not been loaded correctly.
How do I do this ?
Do I need to load the other subforms as well ?
I'm trying to work out how to fix an error, but can't quite get my head around loading recordsets. Any assistance would be appreciated.
I have a button on the switchboard to "Add New Invoice". When pressed this opens "frm_MainInput" and hides navigation buttons :
Code:
Private Sub btn_NewInvoice_Click()
'------------------------------------------------------------
' Switchboard - Add New Invoice
'------------------------------------------------------------
Dim btn_RepeatInvoices As Object
On Error GoTo btn_NewInvoice_Click_Err
DoCmd.OpenForm "frm_MainInput", acNormal, "", "", , acNormal
Forms![frm_MainInput].AllowAdditions = True
Forms![frm_MainInput].NavigationButtons = False
DoCmd.GoToRecord , "", acNewRec
DoCmd.Maximize
'Hide navidation buttons
'show submenu buttons
Forms!frm_MainInput.btn_RepeatInvoices.Visible = True
'button5.Visible = True
DoEvents 'execute any pending events, to make sure the button 4 and 5 are really visible
Forms!frm_MainInput.btn_RepeatInvoices.SetFocus 'change the focus to a now visible control
DoEvents 'execute any pending events, to make sure that button4 really has the focus
'now you can hide the other buttons
'hide main buttons
Forms!frm_MainInput.btn_NewInvoice.Visible = False
Forms!frm_MainInput.btn_Search.Visible = False
Forms!frm_MainInput.btn_First.Visible = False
Forms!frm_MainInput.btn_Previous.Visible = False
Forms!frm_MainInput.btn_Next.Visible = False
Forms!frm_MainInput.btn_Last.Visible = False
btn_NewInvoice_Click_Exit:
Exit Sub
btn_NewInvoice_Click_Err:
MsgBox Error$
Resume btn_NewInvoice_Click_Exit
End Sub
The frm_MainInput form has a tab control with threes subforms (Datasheet view) : frm_MainInputSub, frm_CommissionSub and frm_DebtSub.
Each record in MainInput can have several rows saved in MainInputSub (line items on an invoice). but when I run the above code and select any field in the MainInputSub I get the error :
You entered an expression that has an invalid reference to the property Form/Report
From my research I believe it is because the recordset of the subform (s?) has not been loaded correctly.
How do I do this ?
Do I need to load the other subforms as well ?