G
gigglin''me
I’ve been struggling with this code. It seems to work now except I don’t
understand why the message in grpConcur_AfterUpdate appears when the
condition is "if vendor <> 17 or <> 18" and yet the vendor does = 17 or 18.
Obvioulsy I have something wrong or in the wrong place. Can someone look at
the code and give me feedback.
Not sure how much info you need so will summarize what I’m trying to do here
and if you don’t need it feel free to skip it and go directly to the code
below. I have an input form with several tabs. On the first tab the vendor
and customer info is entered and there is an option group to choose one of 5
programs. The fourth tab has an option group ‘grpConcur’ with three buttons,
Yes, No, and N/A. There are nine option buttons (not in a group) that need to
be checked (all reasons that apply) based certain conditions. The option
group ‘grpConcur’ only applies to Vendors 17 and 18 and only if the program
selected on Tab 1 is 1 or 3. If the vendor is 17 or 18 and the program is 1
or 3 and Concur is Yes or N/A then the nine option buttons are disabled and
the value is false. If all those conditions are met and grpConcur is No, then
the nine option buttons are enabled. But if the vendor is 17 or 18 and the
program is 2, 4, or 5 then the 9 option buttons are disabled and the value is
false.
This is the code and to save space and your time, I’ve only noted one of the
nine option buttons. Also, if there is a better way to write this, feel free
to comment.
Private Sub Form_Current()
If (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value = 1 Or
Me.grpRecourse.Value = 3) And (Me.grpConcur.Value = 1 Or Me.grpConcur.Value =
3) Then
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
ElseIf (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value =
1 Or Me.grpRecourse.Value = 3) And Me.grpConcur.Value = 2 Then
Me.btnPAAnaylsis.Enabled = True
ElseIf (Me.cboVendor <> 17 Or Me.cboVendor <> 18) And Not
(IsNull(Me.grpConcur.Value)) Then
Me.grpConcur.Value = 0
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
End If
End Sub
Private Sub grpConcur_AfterUpdate()
If (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value = 1 Or
Me.grpRecourse.Value = 3) And (Me.grpConcur.Value = 1 Or Me.grpConcur.Value
= 3) Then
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
ElseIf (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value =
1 Or Me.grpRecourse.Value = 3) And Me.grpConcur.Value = 2 Then
Me.btnPAAnaylsis.Enabled = True
ElseIf (Me.cboVendor <> 17 Or Me.cboVendor <> 18) And Not
(IsNull(Me.grpConcur.Value)) Then
Me.grpConcur.Value = 0
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
MsgBox "The Pre-Approved Program is not available based" &
vbCrLf & _
"on the Vendor and/or Recourse Program selected.", vbOKOnly,
"Reminder"
End If
End Sub
Private Sub grpRecourse_BeforeUpdate(Cancel As Integer)
If (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value <> 1
Or Me.grpRecourse.Value <> 3) And Not (IsNull(Me.grpConcur.Value)) Then
Me.grpConcur.Value = 0
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
End If
End Sub
Thank you.
understand why the message in grpConcur_AfterUpdate appears when the
condition is "if vendor <> 17 or <> 18" and yet the vendor does = 17 or 18.
Obvioulsy I have something wrong or in the wrong place. Can someone look at
the code and give me feedback.
Not sure how much info you need so will summarize what I’m trying to do here
and if you don’t need it feel free to skip it and go directly to the code
below. I have an input form with several tabs. On the first tab the vendor
and customer info is entered and there is an option group to choose one of 5
programs. The fourth tab has an option group ‘grpConcur’ with three buttons,
Yes, No, and N/A. There are nine option buttons (not in a group) that need to
be checked (all reasons that apply) based certain conditions. The option
group ‘grpConcur’ only applies to Vendors 17 and 18 and only if the program
selected on Tab 1 is 1 or 3. If the vendor is 17 or 18 and the program is 1
or 3 and Concur is Yes or N/A then the nine option buttons are disabled and
the value is false. If all those conditions are met and grpConcur is No, then
the nine option buttons are enabled. But if the vendor is 17 or 18 and the
program is 2, 4, or 5 then the 9 option buttons are disabled and the value is
false.
This is the code and to save space and your time, I’ve only noted one of the
nine option buttons. Also, if there is a better way to write this, feel free
to comment.
Private Sub Form_Current()
If (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value = 1 Or
Me.grpRecourse.Value = 3) And (Me.grpConcur.Value = 1 Or Me.grpConcur.Value =
3) Then
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
ElseIf (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value =
1 Or Me.grpRecourse.Value = 3) And Me.grpConcur.Value = 2 Then
Me.btnPAAnaylsis.Enabled = True
ElseIf (Me.cboVendor <> 17 Or Me.cboVendor <> 18) And Not
(IsNull(Me.grpConcur.Value)) Then
Me.grpConcur.Value = 0
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
End If
End Sub
Private Sub grpConcur_AfterUpdate()
If (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value = 1 Or
Me.grpRecourse.Value = 3) And (Me.grpConcur.Value = 1 Or Me.grpConcur.Value
= 3) Then
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
ElseIf (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value =
1 Or Me.grpRecourse.Value = 3) And Me.grpConcur.Value = 2 Then
Me.btnPAAnaylsis.Enabled = True
ElseIf (Me.cboVendor <> 17 Or Me.cboVendor <> 18) And Not
(IsNull(Me.grpConcur.Value)) Then
Me.grpConcur.Value = 0
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
MsgBox "The Pre-Approved Program is not available based" &
vbCrLf & _
"on the Vendor and/or Recourse Program selected.", vbOKOnly,
"Reminder"
End If
End Sub
Private Sub grpRecourse_BeforeUpdate(Cancel As Integer)
If (Me.cboVendor = 17 Or Me.cboVendor = 18) And (Me.grpRecourse.Value <> 1
Or Me.grpRecourse.Value <> 3) And Not (IsNull(Me.grpConcur.Value)) Then
Me.grpConcur.Value = 0
Me.btnPAAnaylsis.Value = False
Me.btnPAAnaylsis.Enabled = False
End If
End Sub
Thank you.