[RESOLVED] Access 2003 Visual Basic Run Time Error '424'
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] Access 2003 Visual Basic Run Time Error '424'

  1. #1
    Join Date
    Aug 2012
    Location
    Lubbock, TX
    Posts
    15

    [RESOLVED] Access 2003 Visual Basic Run Time Error '424'

    I am experiencing the infamous Run Time Error '424' like many others have. I have surfed several forums, to no avail, and am now turning to you guys for some help!

    This application was created in order to talk to Peachtree Quantum 2012 through their SDK, and get it to export sales invoice information.

    The problem is caused when defining the date filter for the invoices that are to be exported. The error message says:
    "Run-Time Error: '424':

    Object Required"

    The code is a bit lengthy, and I apologize, but I am going to include all of it so that any errors in the code can be caught, and bring about a resolution.


    Code:
    Option Compare Database
    
    '
    ' Chad Jackson
    ' 7/26/2012
    '
    ' PeachTree Automatic Export
    '
    '
    ' This program will pull specified invoice information from PeachTree
    ' and automatically import it into the Field Ticket Tracking Database.
    '
    
    
    Sub ExportSalesInvoices()
    
     
    
    ' The folder that the exported file should be saved to
    
    Dim fileFolder
    
    fileFolder = "C:\Users\Chad\Documents\Senior Project\Lubbock"
    
     
    
    ' The file name of the exported file
    
    Dim fileName
    
    fileName = "sales_invoices.csv"
    
     
    
    ' Peachtree/Sage 50 Accounting interface
    
    Dim ptApp As PeachtreeAccounting.Application
    
    ' Peachtree/Sage 50 LoginSelector object
    
    Dim ptLoginSelect As PeachtreeAccounting.loginSelector
    
    ' Peachtree/Sage 50 Login object
    
    Dim ptLogin As PeachtreeAccounting.Login
    
    ' Create an application object we can use for exporting data from the Login object
    
    Set ptLoginSelect = New PeachtreeAccounting.loginSelector
    
    Set ptLogin = ptLoginSelect.GetCurrentLoginObject()
    
    Set ptApp = ptLogin.GetApplication("Bergstein Enterprises Ltd", "4A8495XCP825X4L")
    
    ' Create the Exporter
    
    Dim exporter
    
    Set exporter = ptApp.CreateExporter(PeachwIEObj.peachwIEObjSalesJournal)
    
     
    
    ' Clear Export List
    
    exporter.ClearExportFieldList
    
     
    
    ' Choose which fields to export
    
    exporter.AddToExportFieldList (PeachwIEObjSalesJournalField.peachwIEObjSalesJournalField_Amount)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ApplyToInvoiceDistNum)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ApplyToInvoiceNumber)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ApplyToSalesOrder)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ARAccountGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ARAccountId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ARAmount)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_BeginningBalanceTransaction)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_COSTAccountGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_CostOfSalesAccountId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_CostOfSalesAmount)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_CustomerGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_CustomerId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_CustomerName)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_CustomerPurchaseOrder)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_Date)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_DateClearedInAccountRec)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_DateDue)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_Description)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_DiscountAmount)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_DiscountDate)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_DisplayedTerms)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_DropShip)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enApplyToProposal)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enCOSAcntDateClearedInBankRec)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enGL_DateClearedInBankRec)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enInvAcntDateClearedInBankRec)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enProgressBillingInvoice)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enRecur)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enRecurNum)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enRetainagePercent)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enSerialNumber)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enStockingQuantity)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enUMID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enUMStockingUnitPrice)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enUMStockingUnits)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_enVoidedBy)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_GLAccountGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_GLAccountId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_INVAccountGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_InventoryAccountId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_InvoiceDistNum)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_InvoiceNote)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_InvoiceNote2)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_InvoiceNumber)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_IsCreditMemo)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ItemGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ItemId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_JobGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_JobId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_NotePrintsAfterLineItems)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_NumberOfDistributions)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_Quantity)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_Quote)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_QuoteGoodThruDate)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_QuoteNumber)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ReceiptNum)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ReturnAuthorization)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_SalesOrderDistNum)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_SalesOrderNumber)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_SalesRepId)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_SalesRepresentativeGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_SalesTaxAuthority)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_SalesTaxCode)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipByDate)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipDate)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToAddressLine1)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToAddressLine2)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToCity)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToCountry)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToName)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToState)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipToZip)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_ShipVia)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_StatementNote)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_StatementNotePrintsBeforeInvoiceRef)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_TaxType)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_TransactionGUID)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_TransactionNumber)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_TransactionPeriod)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_UnitPrice)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_UPCSKU)
    
    exporter.AddToExportFieldList (peachwIEObjSalesJournalField_Weight)
    
     
    
    ' Set the date range for transactions to export
    ' The next line causes the error:
    Call exporter.SetDateFilterValue(Interop.PeachwServer.PeachwIEDateFilterOperation.peachwIEDateFilterOperationThisPeriod, DateTime.Now, DateTime.Now)
    
     
    
    ' Decide if we want a header row in the CSV file. (1 = Yes / 0 = No)
    
    exporter.SetIncludeHeadersFlag (1)
    
    ' Set the full file path of the exported file
    
    exporter.SetFilename (fileFolder + "\\" + fileName)
    
    ' Set the type of file to export (CSV or XML)
    
    exporter.SetFileType (peachwIEFileTypeCSV)
    
    ' Finally, export the information to the file
    
    exporter.Export
    
     
    
    End Sub

    If you have any questions, please feel free to ask.
    Also, if I have violated forum etiquette, I apologize. This is my first post, and I am still getting acquainted to everything. If you would kindly let me know of any ways I can improve my future posts, I would greatly appreciate it.

    I look forward to your help, and thank you in advance!

    Chad Jackson

  2. #2
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,722

    Re: Access 2003 Visual Basic Run Time Error '424'

    Please make absolutely clear which line is throwing the error.

    The "Object Required" error tells you, that an object variable which should hold the reference to an object, has the value of "Nothing", meaning that the creation of an object has failed. To find out which object that would be, you look at the line which object var produced the error, then look back to find the line where the object is created.
    Once we found out which object has not been created properly we might make some guesses why this is the case.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center