complex code

  • Thread starter Thread starter NEOFYTOS
  • Start date Start date
N

NEOFYTOS

Hello

i have the following code that is working properly

Private Sub EdafoponikiMorfi_AfterUpdate()
If Me.EdafoponikiMorfi = 8 Then
Me.myLabel.Visible = True
Me.EdafoponikiDescription.Enabled = True
Else
Me.myLabel.Visible = False
Me.EdafoponikiDescription.Enabled = False
End If
End Sub

My problem is that i want to write a code in order
to include the following condition in the above code.

-- If Me.EdafoponikiMorfi = 9Then
Me.Standorigin.Enabled = True
else
Me.Standorigin.Enabled = False




THANK YOU
 
Private Sub EdafoponikiMorfi_AfterUpdate()
If Me.EdafoponikiMorfi = 8 Then
Me.myLabel.Visible = True
Me.EdafoponikiDescription.Enabled = True
Else
If Me.EdafoponikiMorfi = 9Then
Me.Standorigin.Enabled = True
Else
Me.Standorigin.Enabled = False
End If
Me.myLabel.Visible = False
Me.EdafoponikiDescription.Enabled = False
End If
End Sub

or, shorter

Private Sub EdafoponikiMorfi_AfterUpdate()
Me.myLabel.Visible = (Me.EdafoponikiMorfi = 8)
Me.EdafoponikiDescription.Enabled = (Me.EdafoponikiMorfi = 8)
Me.Standorigin.Enabled = (Me.EdafoponikiMorfi = 9)
End Sub
 
Back
Top