Peachtree DDE - Using Peachtree 2001
This type of programming may also be used with VB and VBA. While a bit old fashioned it still works. Please enjoy the following DDE example.
Peachtree has a number of export formats that allow moving data into report
writer programs that are of great help. One area that is weak is the employee
area. This tip will show you how to use DDE and Visual FoxPro to “Data Mine” the
employee’s file. A list function does exist for employees.
Step one is to open Peachtree and go to the current period. DDE does not work unless Peachtree is open. Next open Visual FoxPro and create for following table.
Structure for table: EMPLOY01.DBF
Field Field Name Type Width
1 KEY Character 20
2 NAME Character 30
3 ADDRESS1 Character 30
4 ADDRESS2 Character 30
5 ADDRCITY Character 20
6 ADDRSTATE Character 2
7 ADDRZIP Character 12
8 SSN Character 10
9 HIREDATE Date 8
10 TERMINATED Date 8
11 LASTRAISE Date 8
12 TYPE Character 8
The field sizes can be obtained from Peachtree DDE table size data or by counting characters.
Next enter the following program.
* TEST OF DDE OPEN – How to make a list of employees hired before
* Jan 1, 2000. Uses Bellwether Gardens test company data.
STORE 'FIRST' TO rectouse && set record pointer
DO WHILE .T.
IF LEN(ALLTRIM(y1))=0 AND rectouse<>'FIRST'
REPLACE key WITH y1,;
name WITH y2,;
address1 WITH y3,;
address2 WITH y4,;
addrcity WITH y5,;
addrstate WITH y6,;
addrzip WITH y7,;
ssn WITH y8,;
hiredate WITH CTOD(y9),; &&store in date format
terminated WITH CTOD(y10),;
lastraise WITH CTOD(y11),;
type WITH y12,;
STORE 'NEXT' TO rectouse && move record pointer to next record
You may now use VFP functions to do what you’d like with the data with the data..