![]() |
![]() |
|
Quick Links
- Learn How We Can Help
- Read About Recent Projects - Schedule a Class - Pay Your Invoice Online - Request Technical Support
Did you know?
We offer
technical support
for Peachtree Accounting, Microsoft Excel, and DDE by
e-mail,
telephone, or
remotely.
|
|
Using DDE with FoxPro
Our thanks go to John Kang for offering up the following FoxPro routine:
Warning! Code may be wrapped!
lnInitiate = DDEInitiate("peachw","moainc")
IF lnInitiate = -1 *--RUN Peachtree program in inactive minimize mode RUN /N7 C:\PEACHW\PEACHW.EXE BLANK lnTry = 0 DO WHILE .t. lnInitiate = DDEInitiate("peachw","moainc") IF lnInitiate = -1 IF lnTry >= 5 = MESSAGEBOX("Can't initiate conversation with Peachtree.",1,"Connection Failed") RETURN ENDIF lnTry = lnTry + 1 LOOP ENDIF EXIT ENDDO ENDIF = DDEPoke(lnInitiate,"File=cashinjournal,Clear,Field=Date",DTOC(Date())) = DDEPoke(lnInitiate,"File=cashinjournal,Field=Check","123456") = DDEPoke(lnInitiate,"File=cashinjournal,Field=depositticket","000001") = DDEPoke(lnInitiate,"File=cashinjournal,Field=Account","11000") pokestring = "11000"+chr(9)+"500.00"+chr(9)+""+chr(9)+""+chr(9)+""+chr(9)+"001DN"+CHR(9)+ "1"+chr(9)+; ""+chr(9)+"2"+chr(9)+"" = DDEPoke(lnInitiate,"File=cashinjournal,Field=FirstDistribution,Save",pokestr ing) = DDETerminate(lnInitiate)
John Kang comments on his code:
1. If you look at the above sample code, in the beginning of the code I check to see if DDEInitiate was successful. If it wasn't, I start Peachtree. If I immediately try to reinitiate a DDE conversation by calling the DDEInitiate again, it doesn't work. That's why I had to insert a "loop" code to try initiate at least 5 consecutive times before accepting failure. I haven't tested how many tries it takes, but as long as it initiates a conversation within 5 attempts, I have no complaints :). 2. If PT is already open with the company that you'll use DDEPoke to poke journal entries (i.e. Sales Journal in my case), be careful the accounting period it's set to. In my testing, if the current period is 6 and you try to poke a journal for any prior periods, it won't work. You can, however, poke to future periods. The best way for me was to simply set the period to 1 before "batch" poking a lot of journal entries. Did you know that there's an alternative to DDE?PawCOM not only eliminates the need for DDE, it also gives you access to all of the underlying tables in Peachtree, not just the selective availability offered by DDE. This ActiveX control offers both read and write access to Peachtree, and is compatible with Peachtree Accounting and Complete Accounting for Windows version 7 or later.Plus, the DLL file can be distributed with your applications royalty-free! Click Here to Learn More or Purchase PawCOM Now! |
|
|
Accounting Advisors, Inc. 614 Park Avenue SE Atlanta, Georgia 30312 Telephone: 404-784-0275 Toll Free: 800-724-0315 Fax: 404-420-2175 |
||
|
Questions? Comments?
E-mail us or call (404) 784-0275 Our toll free number is (800) 724-0315 © Copyright 2004 by Accounting Advisors Web site designed and maintained by Accounting Advisors, Inc. |
|