visible based on value

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hello,

I have a form based on a query, based on a table with every date in 2009 and
2010 in the first column and usernames in the subsequent columns, so there
are 2 X 365 rows in total. I also have another column that shows what day
the date is, this is called "Day" column. I want to disable the control for
those rows where the day is a Saturday or Sunday.

I have this code in the form load event:

Private Sub Form_Load()

If Me.Day.Value = "Saturday" Then Me.MyComboBox.Visible = False

End Sub

I thought this would work but nothing happens. Can anyone help?

Many thanks in advance.

Martin
 
Use the form's Current event.

BTW, you don't need to store the Day value in your table. Access can figure
it out for you:
Weekday([TheDateField])

Also, if this form is shown in Continuous or Datasheet view, the field will
disappear in all rows (not just the current row.)
 
Back
Top