Jim,
My _guess_ is that when you trace in the editor you have a value in the GETDATE
function which gets set simply because a value is there.
When you run from your button and [Esc] then your command:
SET VAR Date_A = (GETDATE('Pick Processing Start Date'))
might fail because there is no value to set and you can't set a date variable
to an invalid date.
Try setting you variable Date_A to a valid date that must be out of your
expected range. I use 01/01/1900 as my default. Test for whatever default value
you choose rather than null or, if you have a defined range, say 01/01/1950 to
today, test for between 01/01/1950 and .#DATE - you don't really care if it's
null just if it's not in your acceptable range.
Regards,
Alastair.
----- Original Message -----
From: Jim Belisle
To: RBASE-L Mailing List
Sent: Saturday, August 15, 2009 3:01 PM
Subject: [RBASE-L] - GETDATE
Thanks for all the response I received in regards to my question on GETDATE.
I have the below code in a bit button.
This code works fine when I trace it in the RBEDITOR but comes up with a SET
error when run on the form.
The error occurs when I hit the cancel or escape button on the GETDATE
function.
As you can see, the GETDATE function is nested in the WHILE loop.
SET VAR Date_A DATE = NULL
SET VAR Date_B DATE = NULL
SET VAR vAbort INT = 0
SET VAR vMsg TEXT
SET VAR vMsg2 TEXT
WHILE CONT_PROMPT = 'Y' THEN
My code
This works fine!
IF vYesNo = 'No' THEN
SET VAR vAbort = 1
PAUSE 2 USING 'OPPERATION ABORTED!'
BREAK
ENDIF
This part gives the error when I hit cancel or escape (while in the form).
Works fine in the RBEDIT mode.
SET VAR Date_A = (GETDATE('Pick Processing Start Date'))
IF Date_A IS NULL THEN
SET VAR vAbort = 1
PAUSE 2 USING 'OPPERATION ABORTED! NO DATE PICKED.'
BREAK
ENDIF
ENDWHILE
CLS
IF vAbort = 1 THEN
CLEAR VAR Date_A,Date_B,LAST_DATE,CONT_PROMPT,CONT_PROMPT2, +
vmsg,vMsg2,VLAST_DATE,vYesNo,vEndKey,USER_CHECK,vabort
RETURN
CLS
ENDIF
CLEAR VAR
LAST_DATE,CONT_PROMPT,CONT_PROMPT2,vmsg,vMsg2,VLAST_DATE,vYesNo,vEndKey
Any help appreciated.
Jim
------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.57/2303 - Release Date: 08/14/09
18:10:00