Crazy Labels

  • Thread starter Thread starter Scientific
  • Start date Start date
S

Scientific

Hello,

OK, I'm ready to shoot Access. I have two labels "lblDay and lblTime" that
when a condition is met will either be visible or not visible. I noticed
that if lblDay is already visible then lblTime won't appear even though it's
condition has been met. If lblDay is not visible then lblTime will appear.
The only way to get them to both be visible is if lblTime is visible first.
It's driving me crazy.

Here's my code:

Function CheckDaysHours()
Me.lblDay.Visible = False

If Weekday(Date) >= Me.AllowedFrom And Weekday(Date) <= Me.AllowedTo Then
If Time >= Me.BeginTime And Time <= Me.EndTime Then
Me.lblTime.Visible = False
Else
Me.lblTime.Visible = True
End If
Else
Me.lblDay.Visible = True
End If

End Function

Private Sub AllowedFrom_AfterUpdate()
Call CheckDaysHours
End Sub

Private Sub AllowedTo_AfterUpdate()
Call CheckDaysHours
End Sub

Private Sub BeginTime_AfterUpdate()
Call CheckDaysHours
End Sub

Private Sub EndTime_AfterUpdate()
Call CheckDaysHours
End Sub
 
I think I fixed it. It took a lot more code to get the labels to behave so
that tells me there was a problem with the code.

-S
 
Back
Top