Results not showing in Text Box

tmdrake

Registered User.
Local time
Today, 12:14
Joined
Mar 20, 2013
Messages
15
My form contains a combo box "Action" (the resource for the combo box is a table) where the user can select the type of test is being performed. Then there are two text boxes "Pull Force" and Nuggets" where the user enters certain parameters regarding the test. Now based on the selection made in the combo box and the parameters enter into the text boxes, the results will automatically appear in a third text box named "TestResults".

This is the code I've come up with, however the results are not showing.''
Code:
[COLOR=black][FONT=Times New Roman][SIZE=3][FONT=Times New Roman]Private Sub Text25_Click()
Select Case Me.Action
    Case "NegativePullTest"
        If Me.PullForce >= 15 And Me.Nuggets >= 5 Then Me.Text25 = "Passed"
        If Me.PullForce <= 14 And Me.Nuggets <= 4 Then Me.Text25 = "Failed"
        If Me.PullForce >= 15 And Me.Nuggets <= 4 Then Me.Text25 = "Failed"
        If Me.PullForce <= 14 And Me.Nuggets >= 5 Then Me.Text25 = "Failed"
  
    Case "PositivePullTest"
        If Me.PullForce >= 8 And Me.Nuggets >= 5 Then Me.Text25 = "failed"
        If Me.PullForce <= 7 And Me.Nuggets <= 4 Then Me.Text25 = "Passed"
End Select
If Me.Text25 = "Failed" Then
     MsgBox "Test Failed, Input cell with pass pop and then retest"
End If
End Sub[/FONT][/SIZE][/FONT][/COLOR]

Any help in figuring out why the results are not showing, would be greatly appreciated.
 
Do you know how to put in a breakpoint and single step your code? Just click outside the left border and a breakpoint "DOT" will appear. Then run the form and the code will stop at the breakpoint. You can hover over variables to see their contents and use F8 to single step.
 
Also, make sure your combo is returning what you think it should be returning. Many times when you set up a combo, even if you selected a single field, Access will add the ID column in too as hidden. Check the Row Source of the combo for that. If the ID is in there and you are not using the second column ( column(1) ) for the select case, it will never meet the requirements.
 
Thank you both, using both methods, I got it to work.
 
Actually after testing, I have another question on the same topic. Is there anyway to have the results appear without having to click on the field "TestResults". Right now it works when the cursor is put in that TestResults field.
 
How about using the AfterUpdate event of the ComboBox?
 
Assuming you meant putting the code in the AfterUpdate, however when I did that, even if I clicked on the field, the results did not show. If my assumption is incorrect, please let me know what code should I have put in the AfterUpdate.

Thanks
 
If you move the code to the AfterUpdate event of the ComboBox then it will only work when you make a selection from the ComboBox.
 

Users who are viewing this thread

Back
Top Bottom