poohbear2012
Registered User.
- Local time
- Today, 03:54
- Joined
- Jan 8, 2012
- Messages
- 30
Hi
I get the error when opening one of my forms "Application-Defined or Object-Defined error".
Below is the current VBA that I have on the On Current Event on my form. Any suggestions on what I need to do to correct this error would be greatly appreciated. I am working in Access 2010.
Private Sub Form_Current()
On Error GoTo mdlinvoices_SetFormState_Err
With CodeContextObject
Dim varAllowInvoiceChanges As Variant
varAllowInvoiceChanges = Nz(.chkIsNew, True)
DoCmd.SetProperty "frminvoiceproductlineitemssubform", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "frminvoiceservicelineitemssubform", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "cmdSubmitInvoice", acPropertyEnabled, Nz(.chkIsNew, True)
DoCmd.SetProperty "txtDateSubmitted", acPropertyEnabled, Nz(.chkIsNew, False) = True
DoCmd.SetProperty "cmdMarkPaid", acPropertyEnabled, Not (Nz(.chkIsPaid, False)) And Nz(.chkIsSubmitted, False)
DoCmd.SetProperty "txtDatePaid", acPropertyEnabled, Nz(.chkIsPaid, False) = False
DoCmd.SetProperty "txtPaidDate", acPropertyEnabled, Nz(.chkIsPaid, False) = False
DoCmd.SetProperty "cboCustomerID", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "cboSalesPersonID", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceAddress", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceCity", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceSuburb", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServicePostalCode", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceCountry", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServicesGSTRate", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtProductsGSTRate", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txthireGSTRate", acPropertyLocked, varAllowInvoiceChanges = False
End With
mdlinvoices_SetFormState_Exit:
Exit Sub
mdlinvoices_SetFormState_Err:
MsgBox Error$
Resume mdlinvoices_SetFormState_Exit
End Sub
I get the error when opening one of my forms "Application-Defined or Object-Defined error".
Below is the current VBA that I have on the On Current Event on my form. Any suggestions on what I need to do to correct this error would be greatly appreciated. I am working in Access 2010.
Private Sub Form_Current()
On Error GoTo mdlinvoices_SetFormState_Err
With CodeContextObject
Dim varAllowInvoiceChanges As Variant
varAllowInvoiceChanges = Nz(.chkIsNew, True)
DoCmd.SetProperty "frminvoiceproductlineitemssubform", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "frminvoiceservicelineitemssubform", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "cmdSubmitInvoice", acPropertyEnabled, Nz(.chkIsNew, True)
DoCmd.SetProperty "txtDateSubmitted", acPropertyEnabled, Nz(.chkIsNew, False) = True
DoCmd.SetProperty "cmdMarkPaid", acPropertyEnabled, Not (Nz(.chkIsPaid, False)) And Nz(.chkIsSubmitted, False)
DoCmd.SetProperty "txtDatePaid", acPropertyEnabled, Nz(.chkIsPaid, False) = False
DoCmd.SetProperty "txtPaidDate", acPropertyEnabled, Nz(.chkIsPaid, False) = False
DoCmd.SetProperty "cboCustomerID", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "cboSalesPersonID", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceAddress", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceCity", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceSuburb", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServicePostalCode", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServiceCountry", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtServicesGSTRate", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txtProductsGSTRate", acPropertyLocked, varAllowInvoiceChanges = False
DoCmd.SetProperty "txthireGSTRate", acPropertyLocked, varAllowInvoiceChanges = False
End With
mdlinvoices_SetFormState_Exit:
Exit Sub
mdlinvoices_SetFormState_Err:
MsgBox Error$
Resume mdlinvoices_SetFormState_Exit
End Sub