Dick
I would suggest the following
Put the code into a formAction and then call the formAction from the button.
Instead of using SET VAR vUser = userid IN .......
Why not make one hit on the table like this
SELECT userid,username,useremail,typesize,emailpw INTO +
vuser INDICATOR iv1,vusername INDICATOR iv2,vuseremail INDICATOR
iv3,vtype INDICATOR iv4,vuserpw INDICATOR iv5 +
FROM cbusers WHERE machname = .vcbmachine
If the form is only used for sending the email then SET/DEFINE all the
variables in the BeforeFormStart.
If you don't want to change the button I would suggest (for debugging
purpose only) right before the PRINT .......
SHOW VAR
PAUSE
This way you can check your variables to make sure they are what you were
expecting.
Buddy
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dick Fey
Sent: Wednesday, January 14, 2015 6:18 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Email EEP
Pulling whats left of my hair out. Looking for blues clues.
Wrote a small eep that allows a user to E-mail a customer a photo of a product
right from the quote screen. (see below)
Works perfectly when run from the R:Prompt. (screen shot 1)
Put the code in a button on the form and it does not.
When run from the button, and setting show dialog on, several of the fields
show (not defined) and the attachment does not show up. (screen shot 2)
How can that happen ?
--TRACE
SET NULL ' '
SET VAR vvennum TEXT = 'TX' --Test purposes ONLY
SET VAR vimagea TEXT = '1980' -- Test purposes ONLY (Data would come
from the form.)
SET VAR vcbmachine TEXT = NULL
SET VAR vuser TEXT = NULL
SET VAR vusername TEXT = NULL
SET VAR vuseremail TEXT = NULL
SET VAR vtype INTEGER = NULL
SET VAR vuserpw TEXT = NULL
SET VAR vmailto TEXT = NULL
SET VAR vmailme TEXT = NULL
SET VAR vreply TEXT = NULL
SET VAR vbody TEXT = NULL
SET VAR vcbmachine = (CVAL('COMPUTER'))
SET VAR vuser = USERID IN cbusers WHERE machname = .vcbmachine SET VAR
vusername = username IN cbusers WHERE machname = .vcbmachine SET VAR vuseremail
= useremail IN cbusers WHERE machname = .vcbmachine SET VAR vtype = typesize IN
cbusers WHERE machname = .vcbmachine SET VAR vuserpw = emailpw IN cbusers WHERE
machname = .vcbmachine SET VAR vhost TEXT = 'mail.tiw.net'
SET VAR vpath TEXT = ('S:\IMAGES\' + .vvennum + '\' + 'IMG_' + .vimagea
+ '.JPG')
DELETE *.PDF
DIALOG 'Enter Customer No.' vreply nokey 1 +
CAPTION 'Carpet Broker Inc' ICON INFO OPTION +
MESSAGE_FONT_SIZE .vtype |MESSAGE_FONT_COLOR BLUE | THEMENAME Razzmatazz SET
VAR vreply INTEGER SET VAR vmailto = emailadd IN cuslist WHERE cusnum = .vreply
IF vmailto IS NULL THEN
DIALOG 'Enter E-Mail address' vmailto nokey 1 +
CAPTION 'Carpet Broker Inc' ICON INFO OPTION +
MESSAGE_FONT_SIZE .vtype |MESSAGE_FONT_COLOR BLUE | THEMENAME Razzmatazz
ELSE
DIALOG &vmailto vresponse vendkey yes CAPTION 'E-mail to:' ICON INFO +
OPTION MESSAGE_FONT_SIZE 10 |MESSAGE_FONT_COLOR BLUE | +
THEMENAME Razzmatazz
IF vresponse = 'NO' THEN
SET VAR vmailto = NULL
DIALOG 'Enter E-Mail address' vmailto nokey 1 +
CAPTION 'Carpet Broker Inc' ICON INFO OPTION +
MESSAGE_FONT_SIZE .vtype |MESSAGE_FONT_COLOR BLUE | THEMENAME Razzmatazz
ENDIF
ENDIF
SET VAR vdate TEXT = (CTXT(.#DATE))
SET VAR vsubject = 'Product photo from Carpet Broker'
SET VAR vbody TEXT = 'The product photo you requested is attached.'
SET VAR vName TEXT = 'Photo.PDF'
PRINT CBPLetter OPTION PDF|FILENAME &vname |EMAIL +
ON |EMAIL_HOST &vhost| EMAIL_USERID &vuseremail | +
EMAIL_PASSWORD &vuserpw | EMAIL_TO_LIST &vmailto | +
EMAIL_BCC_LIST &vmailme |EMAIL_FROM_NAME Carpet +
Broker |EMAIL_FROM_ADDRESS &vuseremail |EMAIL_SUBJECT &vsubject | +
EMAIL_BODY &vbody | EMAIL_ATTACHMENTS &vpath | +
EMAIL_AUTHENTICATION ON |EMAIL_DELETE_AFTER_SEND +
OFF |EMAIL_SHOW_DIALOG ON --RETURN RETURN
Run from the R:Prompt
Same exact code run from the Button on a form.