Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find invoice number for a credit note 1

Status
Not open for further replies.

MatthewRheinberger

IS-IT--Management
Mar 8, 2007
7
AU
Hi,

I am currently importing invoices/credit notes into AccPac using modified VBA recorded macros. All is going ok; however I have the following need.

When I import a credit note I need to be able to set the APPLINVC field. Although I can do this after the import has occurred by invoking the 'find' tool, I would like some code to help me look the invoice up.

When creating the invoice I set the CUSTPO to a known value, say "TEST_INV"

Is there a way that I can return a previous invoice number
=> APPLINVC = findInvoice(TEST_INV, CUSTPO, IDCUST)

Help much appreciated
 
Thank ettiene,

Do you have some sample code to show how to use OEINVH? I am new to AccPac VBA and would appreciate a head start here.

My thanks for the quick reply.

Matthew
 
This example shows how to search for invoices for customer 1200 and PO number 1234.

Code:
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim OEINVH As AccpacCOMAPI.AccpacView

'Open dblink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
'Open view
mDBLinkCmpRW.OpenView "OE0420", OEINVH

OEINVH.Browse "CUSTOMER=""1200"" AND PONUMBER=""1234""", True

Do While OEINVH.GoNext
    MsgBox "Found invoice " & OEINVH.Fields("INVNUMBER")
Loop

'Cleanup
Set OEINVH = Nothing
Set mDBLinkCmpRW = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top