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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to export the DBF file to QUICKBOOK?

Status
Not open for further replies.

MY3MCS

Technical User
Apr 17, 2003
49
0
0
GB
Hello everyone:

I have a .dbf file that I would like to export to quickbook specifically my invoice.dbf file. Is this possible? Can anybody please tell me how to do it?


Thanks...
 
MY3MCS,

A QuickBooks import file is simply a tab-delimited text file with an .IIF extension. In the simplest terms, all you have to do is create the file and then import it into QuickBooks.

Step 1: Create the Import File
In your VFP application, write the necessary code to build a text file in format that matches the specifications for the version of QuickBooks you are targeting. Give it any name you like, but use an .IIF extension so QuickBooks will recognize it. An example of such a file is provided later in this document.

Step 2: Import it into QuickBooks
In QuickBooks, go to the File menu and chose Import. In the Open File dialog, select the file you created in Step 1 and click Open. QuickBooks will import the records in this file.

Sample Code courtesy of Rick Borup:

* Abstract..: Create a QuickBooks transaction import file for invoices.

* Create the export file, bail out with an error msg if unable to create it.
LOCAL lcExpName, lnFileNo
lcExpName = "myQBFile.IIF"
lnFileNo = FCREATE( lcExpName, 0) && Create and open for Read/Write.
IF lnFileNo < 0 && -1 means error, couldn't create the file.
??CHR(7)
WAIT WINDOW NOWAIT ;
&quot;Error: Can't open file &quot; + lcExpName + CHR(13) + ;
&quot;The QuickBooks 2000 batch file could not be created.&quot;
RETURN
ENDIF

LOCAL lcHdrRec, lcSplitRec, lcEndRec, lcTab
lcTab = chr(9)

* Construct the three header records.
lcHdrRec = &quot;!TRNS&quot; + lcTab + &quot;TRNSID&quot; + lcTab + &quot;TRNSTYP&quot; + lcTab + ;
&quot;DATE&quot; + lcTab + &quot;ACCNT&quot; + lcTab + &quot;NAME&quot; + lcTab + ;
&quot;CLASS&quot; + lcTab + &quot;AMOUNT&quot; + lcTab + &quot;DOCNUM&quot; + lcTab + ;
&quot;MEMO&quot; + lcTab + &quot;CLEAR&quot; + lcTab + &quot;TOPRINT&quot; + lcTab + ;
&quot;ADDR1&quot; + lcTab + &quot;ADDR2&quot; + lcTab + &quot;ADDR3&quot; + lcTab + ;
&quot;ADDR4&quot; + lcTab + &quot;ADDR5&quot; + lcTab + &quot;DUEDATE&quot; + lcTab + ;
&quot;TERMS&quot; + lcTab + &quot;PAID&quot; + lcTab + &quot;SHIPDATE&quot;

lcSplitRec = &quot;!SPL&quot; + lcTab + &quot;SPLID&quot; + lcTab + &quot;TRNSTYP&quot; + lcTab + ;
&quot;DATE&quot; + lcTab + &quot;ACCNT&quot; + lcTab + &quot;NAME&quot; + lcTab + ;
&quot;CLASS&quot; + lcTab + &quot;AMOUNT&quot; + lcTab + &quot;DOCNUM&quot; + lcTab + ;
&quot;MEMO&quot; + lcTab + &quot;CLEAR&quot; + lcTab + &quot;QNTY&quot; + lcTab + ;
&quot;PRICE&quot; + lcTab + &quot;INVITEM&quot; + lcTab + &quot;PAYMETH&quot; + lcTab + ;
&quot;TAXABLE&quot; + lcTab + &quot;REIMBEX&quot; + lcTab + &quot;EXTRA&quot;

lcEndRec = &quot;!ENDTRNS&quot;

* Write the three header records.
=FPUTS( lnFileNo, lcHdrRec) && the !TRNS header record
=FPUTS( lnFileNo, lcSplitRec) && the !SPL header record
=FPUTS( lnFileNo, lcEndRec) && the !ENDTRNS record

* Now, scan the INVOICES table and write a set of three records
* to the export file for each invoice for the specified date.
SELECT invoices
GO TOP
SCAN FOR invoices.invdate = ldDate

* Set the value of the variable fields
lcCustNo = UPPER( ALLTRIM( invoices.custno))
lcDocNo = ALLTRIM( invoices.invoiceno)
lcShipDate = DTOC( invoices.shipdate)
lcPlusAmt = ALLTRIM( STR( invoices.invamt, 13, 2))
lcMinusAmt = &quot;-&quot; + lcPlusAmt

* Set the value of the columns for the transaction record
lcTRNS = &quot;TRNS&quot;
lcTRNSID = &quot;&quot;
lcTRNSTYP = &quot;INVOICE&quot;
lcDATE = lcShipDate
lcACCNT = &quot;Accounts Receivable&quot;
lcNAME = lcCustNo
lcCLASS = &quot;&quot;
lcAMOUNT = lcPlusAmt
lcDOCNUM = lcDocNo
lcMEMO = &quot;&quot;
lcCLEAR = &quot;N&quot;
lcTOPRINT = &quot;Y&quot;
lcADDR1 = &quot;&quot;
lcADDR2 = &quot;&quot;
lcADDR3 = &quot;&quot;
lcADDR4 = &quot;&quot;
lcADDR5 = &quot;&quot;
lcDUEDATE = &quot;&quot;
lcTERMS = &quot;Net 10 Days&quot;
lcPAID = &quot;N&quot;
lcShipDate = lcShipDate

* Create the transaction header record string, and write it to the file.
lcHdrRec = lcTRNS + lcTab + lcTRNSID + lcTab + lcTRNSTYP + lcTab + ;
lcDATE + lcTab + lcACCNT + lcTab + lcNAME + lcTab + lcCLASS + lcTab + ;
lcAMOUNT + lcTab + lcDOCNUM + lcTab + lcMEMO + lcTab + lcCLEAR + lcTab + ;
lcTOPRINT + lcTab + lcADDR1 + lcTab + lcADDR2 + lcTab + lcADDR3 + lcTab + ;
lcADDR4 + lcTab + lcADDR5 + lcTab + lcDUEDATE + lcTab + lcTERMS + lcTab + ;
lcPAID + lcTab + lcShipDate
=FPUTS( lnFileNo, lcHdrRec)

* Set the value of the columns for the split record
lcSPL = &quot;SPL&quot;
lcSPLID = &quot;&quot;
lcTRNSTYP = &quot;INVOICE&quot;
lcDATE = lcShipDate
lcACCNT = &quot;Sales&quot;
lcNAME = &quot;&quot;
lcCLASS = &quot;&quot;
lcAMOUNT = lcMinusAmt
lcDOCNUM = &quot;&quot;
lcMEMO = &quot;&quot;
lcCLEAR = &quot;N&quot;
lcQNTY = &quot;&quot;
lcPRICE = lcPlusAmt
lcINVITEM = &quot;Product&quot;
lcPAYMETH = &quot;&quot;
lcTAXABLE = &quot;N&quot;
lcREIMBEX = &quot;NOTHING&quot; && Not sure if &quot;NOTHING&quot; is really required or not.
lcEXTRA = &quot;&quot;

* Create the split record string, and write it to the file.
lcSplitRec = lcSPL + lcTab + lcSPLID + lcTab + lcTRNSTYP + lcTab + ;
lcDATE + lcTab + lcACCNT + lcTab + lcNAME + lcTab + lcCLASS + lcTab + ;
lcAMOUNT + lcTab + lcDOCNUM + lcTab + lcMEMO + lcTab + lcCLEAR + lcTab + ;
lcQNTY + lcTab + lcPRICE + lcTab + lcINVITEM + lcTab + lcPAYMETH + lcTab + ;
lcTAXABLE + lcTab + lcREIMBEX + lcTab + lcEXTRA
=FPUTS( lnFileNo, lcSplitRec)

* Create the end transaction record string, and write it to the file.
lcEndRec = &quot;ENDTRNS&quot;
=FPUTS(lnFileNo, lcEndRec)

ENDSCAN
=FCLOSE(lnFileNo)

Peping
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top