Conflicting Code (1 Viewer)

Gismo

Registered User.
Local time
Today, 19:42
Joined
Jun 12, 2017
Messages
681
Hi All,
Please could you assist
I have a form with multiple scenarios
2 buttons, if another control is =1 then one button must be visable, if 2 then show other button
also, if any of other controls are null, dont show any of the 2 buttons
The 2 codes below are conflicting each other

my code:
#
Private Sub Form_Current()
If Me.Defered = "1" Then
Me.SaveDefer.Visible = True
Me.Savesignoff.Visible = False
Else
Me.SaveDefer.Visible = False
Me.Savesignoff.Visible = True
End If

If IsNull(Me.CrewChief) Or (IsNull(Me.AME)) Or (IsNull(Me.DualInspector)) Or (IsNull(Me.Defered)) Then
Me.Savesignoff.Visible = False
Me.SaveDefer.Visible = False
Else
Me.Savesignoff.Visible = True
Me.SaveDefer.Visible = True
End If
End Sub#
 

June7

AWF VIP
Local time
Today, 08:42
Joined
Mar 9, 2014
Messages
3,374
If you tried to use CODE tags in your post, it didn't work.

If the Null criteria should take precedence, test that first. If Defered is a number field, don't use quote marks. Consider:
Code:
If IsNull(Me.CrewChief) Or (IsNull(Me.AME)) Or (IsNull(Me.DualInspector)) Or (IsNull(Me.Defered)) Then
    Me.Savesignoff.Visible = False
    Me.SaveDefer.Visible = False
Else
    Me.SaveDefer.Visible = Me.Defered = 1
    Me.Savesignoff.Visible = Not Me.Defered = 1
End If
 

Gismo

Registered User.
Local time
Today, 19:42
Joined
Jun 12, 2017
Messages
681
If you tried to use CODE tags in your post, it didn't work.

If the Null criteria should take precedence, test that first. If Defered is a number field, don't use quote marks. Consider:
Code:
If IsNull(Me.CrewChief) Or (IsNull(Me.AME)) Or (IsNull(Me.DualInspector)) Or (IsNull(Me.Defered)) Then
    Me.Savesignoff.Visible = False
    Me.SaveDefer.Visible = False
Else
    Me.SaveDefer.Visible = Me.Defered = 1
    Me.Savesignoff.Visible = Not Me.Defered = 1
End If
Thank you very much, first time I have this combination
 

Users who are viewing this thread

Top Bottom