Re: Nested If problem
- From: "Jeff Boyce" <nonsense@xxxxxxxxxxxx>
- Date: Mon, 4 Jun 2007 15:43:25 -0700
Carrie
I didn't spot anything right off, but here are a couple ideas... (I'm
assuming "Action" is a combo box - see below).
First, create a procedure behind the form that is not connected to any of
the controls.
Next, for readability, consider using the Select Case command, something
like:
Private Sub RecalcInspectionFrequency()
If (Me!cboAction = Suspend) Then
Select Case Me!Risk_Level
Case "Low"
If Me!Risk_Type Between 1 and 4 Then
Me!Inspection_Frequency = 5
ElseIf Me!Risk_Type = 5 Then
Me!Inspection_Frequency = 1
Else
'?any other conditions to test
End If
Case "Medium"
If Me!Downhole_Option =1 Then
Me!Inspection_Frequency = 3
ElseIf Me!Downhole_Option Between 2 And 3 Then
Me!Inspection_Frequency =5
Else
'?are there any other option values?
End If
Case "High"
If Me!Downhole_Option =1 Then
Me!Inspection_Frequency = 1
ElseIf Me!Downhole_Option = 2 Then
Me!Inspection_Frequency =5
Else
'?are there any other option values?
End If
Case Else
Me!Inspection_Frequency =0
End Select
End If 'test "Suspend
After you create this, call it from the AfterUpdate event of each/every one
of the controls that contribute to the decision. That way, when something
changes in a control, the recaculation is done.
Regards
Jeff Boyce
Microsoft Office/Access MVP
.
- Follow-Ups:
- Re: Nested If problem
- From: carrietom
- Re: Nested If problem
- References:
- Re: Nested If problem
- From: Jeff Boyce
- Re: Nested If problem
- From: Carrie
- Re: Nested If problem
- Prev by Date: Re: Conversion to Acess 2007
- Next by Date: Re: Export Spread*** from Switchboard
- Previous by thread: Re: Nested If problem
- Next by thread: Re: Nested If problem
- Index(es):