Solved Visibility for date field

Kayleigh

Member
Local time
Today, 19:24
Joined
Sep 24, 2020
Messages
709
Would anyone know why is there any reason why I can't change visibility property of date field?
Code I used was: Me.date.visible = false
this code works fine for text boxes...
 
Solution
Date is a reserved word and a very poor choice for a field name. Date of what?

Also I would recommend changing the Controls name to something different from the field so after changing your field to ExpiredDate or DateEntered, I would also change the control name to txtDateEntered, that way you know exactly what you are referring to - either the underlying field or the control.

New users don't appreciate that when they are called the same thing (annoyingly the default in Access) Access will look for the control first then the underlying field value. This can cause all sorts of issues.

Please change the field name first though.
Poor name, but still, does the code actually run?
I've just tried with the same name and it works fine?
 
Date is a reserved word and a very poor choice for a field name. Date of what?

Also I would recommend changing the Controls name to something different from the field so after changing your field to ExpiredDate or DateEntered, I would also change the control name to txtDateEntered, that way you know exactly what you are referring to - either the underlying field or the control.

New users don't appreciate that when they are called the same thing (annoyingly the default in Access) Access will look for the control first then the underlying field value. This can cause all sorts of issues.

Please change the field name first though.
 
Solution
Only time this shouldn't work would be if you tried to do it while the date Control had the Focus.

What event were you trying to do it from?

Linq ;0)>
 
Checked control name - diff to field name as I had renamed on data side but form control didn't change.
Thanks
 
That infers to me that you are not using Option Explicit, which you really should be doing
 

Users who are viewing this thread

Back
Top Bottom