Below is a sample that make use of If statement in VBA......
If strLevel = "guest" Then
Me.Visible = False 'To hide current form
Else
If strLevel = "user" Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.ILDate.ValidationRule = "Between (Date()-90) And Date()"
Me.ILDate.ValidationText = "Date must be within the 3 months from today!"
Me.ILuser.Locked = True
Me.lbl_cost.Visible = False
Me.lbl_price.Visible = False
Me.cost.Visible = False
Me.TotalCost.Visible = False
Else
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.lbl_cost.Visible = True
Me.lbl_price.Visible = True
Me.cost.Visible = True
Me.TotalCost.Visible = True
Me.ILDate.ValidationRule = ""
Me.ILDate.ValidationText = ""
End if
End if
No comments:
Post a Comment