What you want to do is to stop your program in the debugger just before where it's getting the error, then step through till it blows up. Probe around at variable values and determine exactly what's causing it.
You can set a breakpoint by double-clicking in the left margin of the code window in design time, but the debug window has to be open for the breakpoint to happen.
Easier, I often find, is to just put the two lines:
DEBUG
SUSPEND
in the code where I want it to stop. For example:
>
>Mew Code:
>
> LOCAL loSession, loMessage, loRecip
>
DEBUG
SUSPEND
> 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()
>
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement