>I have an option object with four buttons. On changing the option's value, certain actions take place. When I run the debugger, the sequence works correctly. When I'm not running the debugger, the actions behave as if the value of the option were being changed to the PREVIOUS value, not the new value. 'Tis quite bothersome.
>
>Here is the Interactive Change method:
>
>SET STEP ON
>DO CASE
> CASE gnDebitOption = 1
> m.CC_Debit = .F.
> m.bank_Debit = ' '
>*!* REPLACE lvf_leadcontracts.CC_Debit WITH .F.
>*!* REPLACE lvf_leadcontracts.bank_debit WITH ' '
> IF !EMPTY(lvf_leadcontracts.cc_acct) .OR. !EMPTY(lvf_leadcontracts.bankacctno)
> lnOption = MESSAGEBOX('Clear the Existing Debit account number?', 52)
> IF lnOption = 6
> m.cc_Acct = ""
> m.bankAcctNo = ""
>*!* REPLACE lvf_leadcontracts.cc_acct WITH ""
>*!* REPLACE lvf_leadcontracts.bankacctno WITH ""
> ENDIF
> ENDIF
> This.Parent.cntBankDebit.ENABLED = .F.
> This.Parent.cntBankDebit.VISIBLE = .F.
> This.Parent.cntCCDebit.ENABLED = .F.
> This.Parent.cntCCDebit.VISIBLE = .F.
>
> This.Parent.cntBankDebit.Refresh
> This.Parent.cntCCDebit.Refresh
>
> CASE gnDebitOption = 2 && Debit Checking Account
> m.CC_Debit = .F.
> m.bank_Debit = 'C'
>*!* REPLACE lvf_leadcontracts.CC_Debit WITH .F.
>*!* REPLACE lvf_leadcontracts.bank_debit WITH 'C'
> This.Parent.cntBankDebit.ENABLED = .T.
> This.Parent.cntBankDebit.VISIBLE = .T.
> This.Parent.cntCCDebit.ENABLED = .F.
> This.Parent.cntCCDebit.VISIBLE = .F.
>
> This.Parent.cntBankDebit.Refresh
> This.Parent.cntCCDebit.Refresh
> This.Parent.cntBankDebit.txtABARouting.SetFocus
>
> CASE gnDebitOption = 3 && Debit Savings Account
> m.CC_Debit = .F.
> m.bank_Debit = 'S'
>*!* REPLACE lvf_leadcontracts.CC_Debit WITH .F.
>*!* REPLACE lvf_leadcontracts.bank_debit WITH 'S'
> This.Parent.cntBankDebit.ENABLED = .T.
> This.Parent.cntBankDebit.VISIBLE = .T.
>
> This.Parent.cntCCDebit.ENABLED = .F.
> This.Parent.cntCCDebit.VISIBLE = .F.
>
> This.Parent.cntBankDebit.Refresh
> This.Parent.cntCCDebit.Refresh
> This.Parent.cntBankDebit.txtABARouting.SetFocus
>
> CASE gnDebitOption = 4 && Debit Credit Card
> m.CC_Debit = .T.
> m.Bank_Debit = ' '
>*!* REPLACE lvf_leadcontracts.CC_Debit WITH .T.
>*!* REPLACE lvf_leadcontracts.bank_debit WITH ' '
> This.Parent.cntBankDebit.ENABLED = .F.
> This.Parent.cntBankDebit.VISIBLE = .F.
> This.Parent.cntCCDebit.ENABLED = .T.
> This.Parent.cntCCDebit.VISIBLE = .T.
>
> This.Parent.cntBankDebit.Refresh
> This.Parent.cntCCDebit.Refresh
> This.Parent.cntCCDebit.cboCredCard.SetFocus
>ENDCASE
>
>
>End Code Block.
>
>
Sounds like the problem is you're using too many memvars (not the count, necessity and actually you might use as many as you like and could manage). In the first place I'd try changing "gnDebitOption" to "this.Value" as I sensed it (where it's set?) :
With this.Parent
m.bank_Debit = iif( this.value = 2, 'C', iif( this.value = 3, 'S', ' ') )
store inlist( this.value, 2, 3 ) ;
to .cntBankDebit.ENABLED, .cntBankDebit.VISIBLE
store ( this.value = 4 ) ;
to .cntCCDebit.ENABLED, .cntCCDebit.VISIBLE, m.CC_Debit
.cntBankDebit.Refresh
.cntCCDebit.Refresh
Do CASE
Case this.value = 1
If !EMPTY(lvf_leadcontracts.cc_acct) ;
.OR. !EMPTY(lvf_leadcontracts.bankacctno)
If MESSAGEBOX('Clear the Existing Debit account number?', 52) = 6
m.cc_acct = ""
m.bankacctno = ""
Endif
Endif
Case this.value = 2
.cntBankDebit.txtABARouting.SetFocus
Case this.value = 3
.cntBankDebit.txtABARouting.SetFocus
Case this.value = 4
.cntCCDebit.cboCredCard.SetFocus
Endcase
Endwith
Do you really need other memvars (which sound to be global)?
Cetin