help with field on form

V

Van T. Dinh

If the Control [ExpireDate] is a Calculated Control, i.e.
it is bound to an expression or a function, or is bound to
a Calculated Field (from the Query), you can't.

Since you want to be able to manually type in the date
(and presumably you want to store the date for later
retrieval), you will need to bind it to a Field (not a
Calculated Field) so that it will be save to a Table.

One you bind it to a Field, you can use code
to "calculate" the expected expiration date (depending on
what the user selects) and pre-populate the Bound Control
with this expected expire date. However, the user can
overwrite the expected expire date in this case.

HTH
Van T. Dinh
MVP (Access)
 
V

Van T. Dinh

what you have in an expression which can be used as ControlSource of a
Calculated Control, NOT the complete code.

I normally use some other Event that happens prior rather than the Focus
Event on the required Control but I think the GotFocus should be fine.
However, don't put the expression you posted in the OnGotFocus row in the
Properties window. Codes don't work that way.

Check Access VB Help on the GotFocus Event / Event Procedure. Better, check
out a book on Access VBA.
 
Top