Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Supporting Legacy Application (email issue)
Message
De
30/04/2004 19:38:49
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Supporting Legacy Application (email issue)
Divers
Thread ID:
00899971
Message ID:
00899971
Vues:
49
I recently bought a software company with a package called SPM/EM 2000. It was written in FoxPro 7.0. The former owner of the software was not a programmer - he contracted out the programming. I am an experienced Universe Basic programmer, but no verry little about VFP. So far the only things I have done to the package have been chainging tab orders, a few comsetic changes, and re-organizing the directory structure. The program is hard coded to use Outlook in the order entry portion. I changed it to use any MAPI compliant application. Although it appears to work fine, with the changed code, the program crashes when in the middle of the SECOND order. I was hoping someone could tell me where I have went wrong.

Old Code:

* MailObj=CREATEOBJECT("Outlook.Application")
* NameSpace=MailObj.GetNameSpace("MAPI")
* MailItem=MailObj.CreateItem(0)
*!* add multiple recipients...
* IF TYPE('emailaddress')='C' .and. !EMPTY(emailaddress)
* MailItem.Recipients.ADD(ALLTRIM(emailaddress))
* ENDIF
* IF TYPE('e2')='C' .AND. !EMPTY(e2)
* mailitem.recipients.add(ALLTRIM(e2))
* ENDIF
* IF TYPE('e3')='C' .AND. !EMPTY(e3)
* mailitem.recipients.add(ALLTRIM(e3))
* ENDIF
* IF TYPE('e4')='C' .AND. !EMPTY(e4)
* mailitem.recipients.add(ALLTRIM(e4))
* ENDIF
* MailItem.Subject=MailSubject
* MailItem.Body=MailMsg
* MailItem.SEND
* NameSpace.Logoff

Mew Code:

LOCAL loSession, loMessage, loRecip

loSession = CREATEOBJECT("MAPI.Session")
KEYBOARD "{ENTER}"
loSession.Logon()

loMessage = loSession.Outbox.Messages.Add()
loMessage.Subject = MailSubject
loMessage.Text = MailMsg

IF TYPE('emailaddress')='C' .and. !EMPTY(emailaddress)
loRecip = loMessage.Recipients.Add()
loRecip.Name = ALLTRIM(emailaddress)
loRecip.Type = 1 && This is a To, not a CC or BCC
loRecip.Resolve() && This will validate the name you put in above
ENDIF

IF TYPE('e2')='C' .AND. !EMPTY(e2)
loRecip = loMessage.Recipients.Add()
loRecip.Name = ALLTRIM(e2)
loRecip.Type = 3 && This is a To, not a CC or BCC
loRecip.Resolve() && This will validate the name you put in above
ENDIF
IF TYPE('e3')='C' .AND. !EMPTY(e3)
loRecip = loMessage.Recipients.Add()
loRecip.Name = ALLTRIM(e3)
loRecip.Type = 3 && This is a To, not a CC or BCC
loRecip.Resolve() && This will validate the name you put in above
ENDIF
IF TYPE('e4')='C' .AND. !EMPTY(e4)
loRecip = loMessage.Recipients.Add()
loRecip.Name = ALLTRIM(e4)
loRecip.Type = 3 && This is a To, not a CC or BCC
loRecip.Resolve() && This will validate the name you put in above
ENDIF
loMessage.Update()
loMessage.Send()
loSession.LogOff()

The message that I am getting is:

E-Trap 2000

2.2004.487
Command contains unrecognized phrase/keyword

Big Long Select Statement Follows.... into cursor Viewcalc56
Error number: 36
File:....
Line Number: 7
Quit, Retry or Ignore

The problem is that where it is telling me that the error doesn't seem to be the problem. Here is that code (lines 1-9)

ERASE DATA\noitemcopy.DBF
IF USED('noitemcopy')
USE IN noitemcopy
ENDIF
SELECT neworditems
temporarydbf = SYS(5)+CURDIR()+'data\'+SYS(3)+'.dbf'
COPY TO &temporarydbf
SELECT 0
USE &temporarydbf ALIAS noitemcopy

Any ideas?

Also, I am looking for the best resources to start learning VFP. All the books seem to be very specific and not general starting points.

Randy Wessels
randy@screentek.com
www.screentekcorp.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform