Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to get pass/fail specs working in VBA 1

Status
Not open for further replies.

SeadnaS

Programmer
May 30, 2011
214
Ok I have a form with an option group of option buttons. Next to them are corresponding text boxes. Each button represents a test and if the the test is passed i need the box to say PASS or FAIL if the test fails.

I have a query called Q_CALC which calculates the AVG, STDEV and AVG-3SIGMA. I have a subform (in datasheet view) also the subform has fields linked to the main form. When I have a record selected in the main form it shows a limited selection of records on the subform based on the selection on the mainform.

For the first test i need to see if the AVG-3SIGMA of column x1 is above or below a number in a table called specs based on the model number selected. The specs table contains pass fail specs for all the different model numbers. Hope that makes sense, really cant figure it out, (lack of VBA skills :( )

Thanks in advance! Can upload screenshots or empty copy of DB if needs be.
 
I a lot done. And im using this if statement:

If Me.sigma <= Me.SPEC1 Then
Me.pass1.Value = "FAIL"
Else: Me.pass1.Value = "PASS"
End If

I have my values that i need to check in two boxes, SPEC1 and sigma. The above statement keeps giving me a PASS even when it should be FAIL. Cant figure it out.
 
I've uploaded a copy of the MDB. I cant get the PASS/FAIL box next to rupture pressure to work. The vba code in on lost focus event for the option button must be wrong. But i cant see how. Frustrating. Also you may notice the error about the form Calculations that pops up when opening the DB. I dont understand why this keeps popping up.
 
 http://www.mediafire.com/?u0y5jrzpm7y75yj

Have you tried stepping through the code to see what values you actually have?
Code:
[b][red]Debug.Print Me.sigma
Debug.print Me.SPEC1[/red][/b]
If Me.sigma <= Me.SPEC1 Then
Me.pass1.Value = "FAIL"
Else: Me.pass1.Value = "PASS"
End If


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top