Heres the code from an additional contacts import program that I wrote years and years ago (Delphi 2 originally for this code). Theres not much validation in but it does show you how to search update etc. This was written for GoldMine dBase (the TOP command can really mess with SQL).
sResp := Form1.ddeClientConv1.RequestData('[REPLACE
('+hCS+',ACCOUNTNO,"'+sResp+'")]');
sResp := Form1.ddeClientConv1.RequestData('[REPLACE
('+hCS+',RECTYPE,"C")]');
If Trim(Form1.Edit1.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit1.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',CONTACT,"'+sResp+'")]');
End;
If Trim(Form1.Edit2.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit2.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',TITLE,"'+sResp+'")]');
End;
If Trim(Form1.Edit3.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit3.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',CONTSUPREF,"'+sResp+'")]');
End;
If Trim(Form1.Edit4.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit4.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',ADDRESS1,"'+sResp+'")]');
End;
If Trim(Form1.Edit5.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit5.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',ADDRESS2,"'+sResp+'")]');
End;
If Trim(Form1.Edit6.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit6.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',ADDRESS3,"'+sResp+'")]');
End;
If Trim(Form1.Edit7.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit7.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',CITY,"'+sResp+'")]');
End;
If Trim(Form1.Edit8.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit8.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',STATE,"'+sResp+'")]');
End;
If Trim(Form1.Edit9.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit9.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',ZIP,"'+sResp+'")]');
End;
If Trim(Form1.Edit10.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit10.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',COUNTRY,"'+sResp+'")]');
End;
If Trim(Form1.Edit12.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit12.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',PHONE,"'+sResp+'")]');
End;
If Trim(Form1.Edit13.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit13.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',EXT,"'+sResp+'")]');
End;
If Trim(Form1.Edit14.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit14.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',FAX,"'+sResp+'")]');
End;
If Trim(Form1.Edit15.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit15.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',DEAR,"'+sResp+'")]');
End;
If Trim(Form1.Edit16.Text)<>' Then
Begin
sResp := Form1.ddeClientConv1.RequestData
('[READ('+hIMP+','+Trim(Form1.Edit16.Text)+')]');
sResp := Form1.ddeClientConv1.RequestData
('[REPLACE('+hCS+',MERGECODES,"'+sResp+'")]');
End;
// Read and write Notes
If Trim(Form1.Edit17.Text) <> ' Then
Begin
iLen := StrToInt
(0+Form1.ddeClientConv1.RequestData('[READ('+hIMP+',"LEN
('+#39+Trim(Form1.Edit17.Text)+#39+'")]'));
If iLen > 0 Then
Begin
iX := 1;
While iX < iLen do
Begin
sResp := Form1.ddeClientConv1.RequestData('[READ('+hIMP+',"SUBSTR
('+#39+Trim(Form1.Edit17.Text)+#39+','+IntToStr(iX)
+',65)"))]');
sResp :=
Form1.ddeClientConv1.RequestData('[REPLACE
('+hCS+',NOTES,"'+sResp+'")]');
iX := iX + 65;
End;
End;
End;
procedure TForm1.FormCreate(Sender: TObject);
begin
If FindWindow('GMFrame',nil)<1 Then
Begin
ShowMessage('Start GoldMine First.');
Application.Terminate;
End;
end;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.