![]() |
![]() |
|
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 Microsoft Visual Basic
Our thanks go to David Oddy for contributing the following Visual Basic code:
Warning! Code may be wrapped!
'(c) Odyssey Software, LLC - 1997, 1998
'Peachtree integration module Option Explicit Public Sub PostSalesHeader(txtLink As TextBox, cAccountingCompany As String, cAccountingKey As String, cPurchaseOrder As String) 'Post header information With txtLink 'Setup company link .LinkMode = 0 .LinkTopic = "peachw" & "|" & cAccountingCompany .LinkMode = 2 'Start edit and post date .LinkItem = "File=Salesjournal,Clear,Field=Date" .Text = Trim$(CStr(Date)) .LinkPoke 'Post customer .LinkItem = "File=Salesjournal,Field=Customer" .Text = Trim$(cAccountingKey) .LinkPoke 'Post purchase order if present If cPurchaseOrder <> vbNullString Then .LinkItem = "File=Salesjournal,Field=PurchaseOrder" .Text = Trim$(cPurchaseOrder) .LinkPoke End If End With End Sub Public Sub PostSalesDetail(txtLink As TextBox, cGLAccount As String, cInventoryItem As String, nAmount As Currency, nQuantity As Currency, cDescription As String, lTaxable As Boolean, lFirstDetail As Boolean, lLastDetail As Boolean) Dim cLinkItem As String Dim cLinkText As String 'Setup link item cLinkItem = "File=Salesjournal,Field=" If lFirstDetail Then LinkItem = cLinkItem & "FIRSTDISTRIBUTION" Else cLinkItem = cLinkItem & "NEXTDISTRIBUTION" End If If lLastDetail Then cLinkItem = cLinkItem & ",SAVE" End If 'Setup link text cLinkText = cGLAccount & Chr$(9) & _ (nAmount * -1) & Chr$(9) & _ cInventoryItem & Chr$(9) & _ nQuantity & Chr$(9) & _ cDescription & Chr$(9) & _ Chr$(9) & _ IIf(lTaxable, 1, 2) & Chr$(9) 'Post detail row With txtLink .LinkItem = cLinkItem .Text = cLinkText .LinkPoke End With End Sub
The first routine (PostSalesHeader) expects the following parameters:
txtLink AS TextBox A text box used to establish the link cAccountingCompany AS String The name of the company file cAccountingKey AS String The customer key cPurchaseOrder AS String An optional purchase order The second routine (PostSalesDetail) expects the following parameters: txtLink AS TextBox A text box used to establish the link cGLAccount AS String The GL account for the distribution cInventoryItem AS String The inventory item nAmount AS Currency The amount of the distribution nQuantity AS Currency The quantity of the distribution cDescription AS String The description lTaxable AS Boolean Indicates whether item is taxable lFirstDetail AS Boolean True for first distribution lLastDetail AS Boolean True for last distribution
David Oddy comments on his code:
The code above is complete.
It should be placed in a basic module and then can be called from other locations.
In both cases, I am trapping for errors at a higher level, so there is no error trapping present.
Also, the code assumes valid data such as company file, customer key, GL account, item number, etc....
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. |
|