can not get code to work.

john527

Registered User.
Local time
Today, 13:21
Joined
Jul 9, 2006
Messages
36
Hi, can someone help me with this code I do not get a return ( 5 ) or ( 10 ) ( 15 ).
Anyone have a solution,any help would be appreciated.

Private Sub cust_credit_score_1_AfterUpdate()

If [Forms]![test credit]![cust_credit_reply_1] = " [Bad Credit]" Then
[Forms]![test credit]![cust_credit_score_1] = 5

Else

If [Forms]![test credit]![cust_credit_reply_1] = " [Poor Credit]" Then
[Forms]![test credit]![cust_credit_score_1] = 10

Else

[Forms]![test credit]![cust_credit_score_1] = 15

End If

End If
End Sub

Thank You John527
 
Code:
Private Sub cust_credit_score_1_AfterUpdate()

If [Forms]![test credit]![cust_credit_reply_1] = " [Bad Credit]" Then
   [Forms]![test credit]![cust_credit_score_1] = 5
ElseIf [Forms]![test credit]![cust_credit_reply_1] = " [Poor Credit]" Then
   [Forms]![test credit]![cust_credit_score_1] = 10
Else
   [Forms]![test credit]![cust_credit_score_1] = 15
End If

End Sub
Did you intend to test against a leading space? " [Bad Credit]"
 
Last edited:
Have a look at the attached sample; I have given you three choices, including fixing "your way".
 

Attachments

Thank You RuralGuy
I test you code and all i get is the number 15 can not get a return of 5 or 10.

I Thank you for your help...
 
I just realized you are trying to change the [cust_credit_score_1] control in its own AfterUpdate event. Why are you doing that?
 
John,
That is because the [cust_credit_reply_1] control in *never* equal to " [Bad Credit]" or " [Poor Credit]"! As I said, did you want the leading space?
 
Hi RuralGuy
Sorry about this, but i do not understain, control in *never* equal & leading space can youexplain this to me.

Thank You.

John
 
The following test has a leading space:
If [Forms]![test credit]![cust_credit_reply_1] = " [Bad Credit]" Then
The next test does not have a leading space:
If [Forms]![test credit]![cust_credit_reply_1] = "[Bad Credit]" Then
Why not single step through the code and see what is happening.
 

Users who are viewing this thread

Back
Top Bottom