Greetings All,
I'm finally getting around to addressing my speed bump after trying to create ways around it.
I am wanting my users to setup (4) security questions when they register on the application (which is a desktop application).
Registration Form Load Event follows:
LOCAL LcRowSource, lcAvail_Source
PUBLIC Quest_Flag1, Quest_Flag2, Quest_Flag3, Quest_Flag4
Quest_Flag1 = .f.
Quest_Flag2 = .f.
Quest_Flag3 = .f.
Quest_Flag4 = .f.
SELECT v_secureques
COPY STRU TO USED_Quest WITH PROD
select allt(v_secureques.quest_text) as avail_text, ;
v_secureques.pk_quesid as questid, v_secureques.selected as sele_ques ;
from v_secureques into cursor crsAvail4
select allt(v_secureques.quest_text) as avail_text, ;
v_secureques.pk_quesid as questid, v_secureques.selected as sele_ques ;
from v_secureques into cursor crsAvail3
select allt(v_secureques.quest_text) as avail_text, ;
v_secureques.pk_quesid as questid, v_secureques.selected as sele_ques ;
from v_secureques ;
WHERE v_secureques.pk_quesid NOT IN (select pk_quesid FROM used_quest) ;
INTO CURSOR CrsAvail2
select allt(v_secureques.quest_text) as avail_text, ;
v_secureques.pk_quesid as questid, v_secureques.selected as sele_ques ;
from v_secureques ;
WHERE v_secureques.pk_quesid NOT IN (select pk_quesid FROM used_quest) ;
INTO CURSOR CrsAvail1
When the user selects any security question, the drop down does allow them to pick their security question. That particular should question should not and does not appear in any of the other 3 security questions to be answered.
The Click event of the combo box follows:
**********
*** Security question 1 CLICK EVENT
**************************
*!* Quest_Flag1 = .f.
*!* Quest_Flag2 = .f.
*!* Quest_Flag3 = .f.
*!* Quest_Flag4 = .f.
IF Quest_Flag1 = .F. && First occurrance of security question selection
SELECT cRsAvail1
oVar.questid_1 = cRsAvail1.questid
oVar.CurRec_1 = RECNO()
INSERT INTO used_quest (pk_quesid, SELECTED, QUEST_TEXT) VALUES (oVar.questid_1, .T., 'NEW FIRST')
Quest_Flag1 = .T.
ThisForm.quest1_text.Enabled = .t.
SELECT V_SECUREQUES
LOCATE FOR v_secureques.pk_quesid = oVar.questid_1
BROWSE
replace v_secureques.pk_quesid WITH 0004711
BROWSE
ThisForm.Combo2.Requery()
ThisForm.Combo3.Requery()
ThisForm.Combo4.Requery()
ELSE
** the user changed their mind on which question they wanted to answer for Question Number 1.
SELECT used_quest
GO top
BROWSE
SCAN FOR used_quest.pk_quesid = oVar.QuestId_1
IF ALLTRIM(UPPER(used_quest.quest_text)) == "NEW FIRST"
replace used_quest.pk_quesid WITH 11171911
replace used_quest.quest_text WITH "OLD FIRST"
replace used_quest.selected WITH .F.
ELSE
LOOP
endif
ENDSCAN
SELECT cRsAvail1
oVar.questid_1 = cRsAvail1.questid
oVar.Curr_rec = RECNO()
INSERT INTO used_quest (pk_quesid, SELECTED, QUEST_TEXT) VALUES (oVar.questid_1, .T., 'NEW FIRST')
SELECT V_SECUREQUES
LOCATE FOR v_secureques.pk_quesid = oVar.questid_1
ThisForm.Combo2.Requery()
ThisForm.Combo3.Requery()
ThisForm.Combo4.Requery()
ENDIF
The Requery event of the combo box follows:
IF Quest_Flag1 = .T.
select allt(v_secureques.quest_text) as avail_text, ;
v_secureques.pk_quesid as questid, v_secureques.selected as sele_ques ;
from v_secureques ;
WHERE v_secureques.pk_quesid NOT IN (select pk_quesid FROM used_quest WHERE ;
ALLTRIM(UPPER(used_quest.QUEST_TEXT)) != 'NEW SECOND' ;
OR ALLTRIM(UPPER(used_quest.QUEST_TEXT)) != 'NEW THIRD' ;
OR ALLTRIM(UPPER(used_quest.QUEST_TEXT)) != 'NEW FOURTH') ;
INTO CURSOR CrsAvail1
The problem that I am having is: If the user selects more than 1 security question but wants to go back and Change a security question selection, that security question is NO LONGER available in the dropdown box. As a matter of fact, the security question sometime resets itself to whatever the next record is. I have been playing with this for months so please excuse the cumbersome nature of the code.
Thanks in Advance.
J. Turner