Application-Defined or Object-Defined Error (1 Viewer)

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
 
Would help if we could know WHERE does the error occur and WHAT is the error(with error number) that you encounter.. Cannot really tell anything from what you have given..
 
No error number comes up just a message box with only an OK button. When I select the OK button it takes me to the active form, without showing the VBA.
 
Have you tried Debugging or Compiling before opening the form to see if you have any compiler error?
 
Repeat after me:


attachment.php
 

Attachments

  • bart-simpson-generator.gif
    bart-simpson-generator.gif
    38.8 KB · Views: 1,139
I have tried this without success, still encountering the same error
 
Repeat after me
Code:
without commenting out On Error

or.... have a robust / well tested error handler that is able to a produce detailed of what happened that the language deems an error. Example:

Code:
Date: 20111208 Time: 10:15:50 UserID: c_mlueck
AppErrorMsg: Class: clsObjPartsTbl, Function: Insert()
Error Source: Microsoft OLE DB Provider for ODBC Drivers
Error Number: -2147217900
Error Description: [Microsoft][ODBC SQL Server Driver][SQL Server]PartNumber 0715001134 already exists in parts table.
MessageText: Error not found.

or

Date: 20120403 Time: 13:04:06 UserID: c_mlueck
AppErrorMsg: Class: clsObjBuyerOMTbl, Function: StandardToUSA()
Error Source: Microsoft Office Access Database Engine
Error Number: -2147217900
Error Description: Extra ) in query expression '((([t].[pddoco]) = ) AND (([t].[pdlnid]) = ))'.
MessageText: Error not found.
 
Last edited:
Excellent news, poohbear2012. So what was the error you have resolved? Perhaps it will help someone else out documenting the solution along with your original problem.
 

Users who are viewing this thread

Back
Top Bottom