At 09:28 AM 1/8/2016, TOM HART wrote:

Razz,
Thank you very much that did the trick.
On a side note, I have been using Rbase since 1983(when I was in the 'ol biddness') and am totally self taught, but this year I will make it to one of the training programs(finally have the time), my question to you is - can teach an old dog new
tricks?  Stupid question because I know the answer is YES.

Tom,

Remember, get the best education you can, and never stop learning!

Yes, it is never too late to teach an old dog new tricks! If you adopt an adult or even a senior dog, you may be amazed at their ability to concentrate and learn new
things.

Adult dogs are often even easier to train than pups, simply because they have the
ability to focus for a longer period of time.

Take a look at the scheduled dates and locations for R:BASE training sessions ...

http://www.rbaseuniversity.com/SuperAdvancedRBASE.php

Very Best R:egards,

Razzak


At 08:26 AM 1/8/2016, TOM HART wrote:

>I can get the action to fire both on before and on after but I cannot get
>the form to close. I have a watch variable that sets to 0 if the password
>fails and I've tried on entry to the first field if vwatch  =0 then
>closewindow
>endif
>
>but that does not close form


You CANNOT call (execute) a Custom Form Action in On Before Form Start EEP.

Carefully TRACE the form to see the exact behavior.

Having stated that ...

If you wish to validate a user access by asking a password as On Before Form
Start EEP, close the form if not a valid password, then, use the following
technique.

-- A very simple example
-- Use the following code as On Before Form Start EEP
-- January 8, 2016
-- Start here ...
    SET VAR vPassword TEXT = NULL
    SET VAR vOK TEXT = NULL
    SET VAR vEndkey TEXT = NULL
    SET VAR vCaption TEXT = 'Application Security'
LABEL GetPassword
    CLS
    DIALOG 'Enter Password' vPassword=29 vEndKey PASSWORD +
    CAPTION .vCaption ICON WINDOWS +
    OPTION WINDOW_BACK_COLOR WHITE +
    |MESSAGE_BACK_COLOR WHITE +
    |MESSAGE_FONT_NAME Tahoma +
    |MESSAGE_FONT_COLOR RED +
    |MESSAGE_FONT_SIZE 12 +
    |INPUT_BACKGROUND_COLOR YELLOW +
    |INPUT_FONT_NAME Tahoma +
    |INPUT_FONT_COLOR RED +
    |INPUT_FONT_SIZE 12 +
    |BUTTON_YES_CAPTION &Continue +
    |BUTTON_YES_COLOR WHITE +
    |BUTTON_YES_FONT_COLOR GREEN +
    |BUTTON_NO_CAPTION C&ancel +
    |BUTTON_NO_COLOR WHITE +
    |BUTTON_NO_FONT_COLOR RED
IF vPassword IS NULL OR vEndKey = '[Esc]' THEN
    SET VAR vOK = 'No'
    GOTO Done
ENDIF
IF vPassword = 'whatever' THEN
    SET VAR vOK = 'Yes'
    GOTO Done
ELSE
    CLS
    PAUSE 2 USING 'Invalid Password Entered!' +
    CAPTION .vCaption ICON WARNING +
    BUTTON 'Press any key to re-enter password'+
    OPTION BACK_COLOR WHITE +
    |MESSAGE_FONT_NAME Tahoma +
    |MESSAGE_FONT_COLOR RED +
    |MESSAGE_FONT_SIZE 11
    SET VAR vPassword = NULL
    GOTO GetPassword
ENDIF
LABEL Done
    CLEAR VARIABLES vPassword,vEndKey,vCaption
    RETURN
-- End here ...

And, use the following code as On After Form Start EEP:

-- Start here ...
IF vOK = 'No' THEN
    CLOSEWINDOW
ENDIF
    CLEAR VARIABLES vOK
    RETURN
-- End here ...

That should provide you with a very simple technique to validate the access
and then close the form accordingly.

Note:

Make sure to change the QUOTE settings used in this example based upon your
database QUOTE settings, if necessary.

Too overwhelming? Hopefully not!

Very Best R:egards,

Razzak


Reply via email to