Credit Code Get No Return ?

john527

Registered User.
Local time
Today, 13:06
Joined
Jul 9, 2006
Messages
36
Can some one help me with this code, I get no return, ???

. Private Sub cust_credit_score_1_AfterUpdate()

If [Forms]![Customer Form]![cust_credit_reply_1] = " [Bad Credit]"Then
[Forms]![Customer Form]![cust_credit_score_1] = 5

ElseIf [Form]![Customer Form]![cust_credit_reply_1] = "[PoorCredit]"Then
[Forms]![Customer Form]![cust_credit_score_1] = 10
Else
[Forms]![Customer Form]![cust_credit_score_1] = 15
End If

End Sub


Thank You For Your Help

Johnny C.
 
Why are you trying to change the value of a control in the AfterUpdate event of the same control?
 
Hi, RuralGuy, thank you for your help but i do not understain what you mean by control in the Afterupdate event of the same control.

Johnny C
 
What he means is -

The code you showed appears to be on the AfterUpdate event of the control named, "cust_credit_score_1" and you should not have code that updates "cust_credit_score_1" in it's own AfterUpdate event. What will happen is that you will potentially get stuck in an infinite loop.

This is because the AfterUpdate event for a control happens after the change to the control is committed and then, if you change the control's value again via code, it fires the AfterUpdate event again, which could update the control again, and so on, and so on, etc.
 
question regarding problem

No that I understand the issues how would I go about correcting it? What options or function should I use to correct? If possible send me menu selection and options. Thanks
 
question regarding problem

Now that I understand the issues how would I go about correcting it? What options or function should I use to correct? If possible send me menu selection and options. Thanks
 
Why don't you describe in words what you are trying to achieve and we can probably offer some suggestions. What type of controls are the two controls you are working with?
 
This is what i am trying to do...

What is rong with code ?????

If [Forms]![Customer Form]![cust_credit_reply_1] = " [Bad Credit]"Then
[Forms]![Customer Form]![cust_credit_score_1] = 5

ElseIf [Form]![Customer Form]![cust_credit_reply_1] = "[PoorCredit]"Then
[Forms]![Customer Form]![cust_credit_score_1] = 10
Else
[Forms]![Customer Form]![cust_credit_score_1] = 15
End If

End Sub
 
Bob Larson accurately explained to you what is wrong with your code. What part of his explaination did you not understand?
 
I do appreciate the response but I am a novice at Access and need quite a bit more hand holding. I would appreciate any help possible. I understand the problem I just don't know how to do it the correct way or how to fix what i already did.
 
I'm sorry John but I have to say it again:
Why don't you describe in words what you are trying to achieve and we can probably offer some suggestions. What type of controls are the two controls you are working with?
 
Basically I am using a text box to chose a selection of credit scores so if they have an excellent credit the score should be 50. however when I select the box for say excellent score nothing calculates or show any number based on the calculation above. I hope this helps. I am truly a beginner.
 
A TextBox or a ComboBox? Is the user typing in [PoorCredit] or [Bad Credit] into a TextBox or selecting it from a ComboBox? If it is a ComboBox then what is the RowSource and RowSourceType?
 
The row source type - table/query
row source customer_credit_good_bad_tables
 
Is customer_credit_good_bad_tables a Query? If so can you post the SQL for that query? Go into the query builder for that query in design mode and then go to View>SQL View and post what is there.
 
SELECT [Customer Credit_Good_Bad_Table].cust_credit_gbp_table
FROM [Customer Credit_Good_Bad_Table];
 
Thanks John,
Any chance there is another field in the [Customer Credit_Good_Bad_Table] that contains the numerical value you need so you don't need to hard code it? Then you could pull that additional field and put it in the other control. Am I correct in that the name of the ComboBox control is [cust_credit_reply_1] which makes the [cust_credit_score_1] control a TextBox? It can be done either way but having the CreditNumber in a field in the table is more flexible. If anything changes down the road the user won't have to call the programmer. ;)
 
SELECT [Customer Credit_Good_Bad_Table].cust_credit_gbp_table
FROM [Customer Credit_Good_Bad_Table];
 
Customer credit_good_bad_table form
cust_credit_reply_1 is a textbox and a combobox gets its information from credit_good_bad_table form.
cust_credit_score_1 is a number field.
 
What is the name of the ComboBox control? Are there any other fields in the [Customer Credit_Good_Bad_Table]? What are they?
 

Users who are viewing this thread

Back
Top Bottom