Affichage des articles dont le libellé est Using the '.Value' Property. Afficher tous les articles
Affichage des articles dont le libellé est Using the '.Value' Property. Afficher tous les articles

Using the '.Value' Property

mercredi 22 avril 2015

Question guys: When is it appropriate to use the '.Value' property in your code? I'm OCD about keeping code as neat as possible, and I started wondering if I was doing things properly. For example, when referring not to a control, but a field in a linked table, which is the "correct" form to use? (Both work!)

Code:

Me.ModifiedTimestamp.Value = Now()

If Me.ModifiedTimestamp.Value = XYZ Then

or

Code:

Me.ModifiedTimestamp = Now()

If Me.ModifiedTimestamp = XYZ Then

There are lots of instances where I am either calling a value, or setting a value, and in both cases, up until now I was using the '.Value' property, but I'm starting to wonder if that is unnecessary. If you just reference the field, does Access automatically know you're referring to its property? When WOULD you use .Value, and when wouldn't you? Or should you always use it for good measure? Someone school me!

Thanks!
Using the '.Value' Property

Labels