Expression in Default Value

S

sweetp

I have:

=DateAdd("y",+[Days_Due_To_Expire],[Date])

in my Control Source of a form and it adds the two controls together fine and shows it on the form.

But to get it to insert into the database, I need to move the expression to Default Value and bind the Control Source to the database field. When I do this, the [Days_Due_To_Expire] doesn't add to the date anymore (I only get the [Date] value to show up in the database.

Any ideas???? I'm pretty new to this expression stuff.
 
M

Marshall Barton

sweetp said:
I have:

=DateAdd("y",+[Days_Due_To_Expire],[Date])

in my Control Source of a form and it adds the two controls together fine and shows it on the form.

But to get it to insert into the database, I need to move the expression to Default Value and bind the Control Source to the database field. When I do this, the [Days_Due_To_Expire] doesn't add to the date anymore (I only get the [Date] value to show up in the database.

Any ideas???? I'm pretty new to this expression stuff.


Where does the [Days_Due_To_Expire] value come from?

What is the [Date] value? A field, control or the function?

It looks like it comes from another bound text box on the
form. If so, you have an issue that the default values are
applied on the first keystroke in a new record, so you can
not change [Days_Due_To_Expire] and then get it to be used
in another control in the same record.

If the [Days_Due_To_Expire] text box is not bound, then this
will work, but it seems that Access tries to calculate the
default values when the form is opened and doesn't
recalculate it until you move to a different new record (or
at least(?) dirty the current new record and then use escape
twice to restart the new record).

If [Date] is also an unbound control, the the above applies
to it too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top