DateDiff Troubles

M

Marie

I am trying to use the DateDiff formula in a form. This
is what I have typed into the control source for the field
on the form (I aquired the formula from the MS Access
help):

=DateDiff("d",[DateFieldA],[DateFieldB])

When I return to the form view my field shows "Name?" I'm
sure I am missing something simple. What do I need to do
different? Also, to avoid future confusion on my part, is
the solution the same for reports?

Thanks!
 
R

Roger Carlson

Chances are the name of the textbox is the same as one of your fields. That
is the most common cause of this error. Try prefixing your textbox name
with txt.
 
F

fredg

I am trying to use the DateDiff formula in a form. This
is what I have typed into the control source for the field
on the form (I aquired the formula from the MS Access
help):

=DateDiff("d",[DateFieldA],[DateFieldB])

When I return to the form view my field shows "Name?" I'm
sure I am missing something simple. What do I need to do
different? Also, to avoid future confusion on my part, is
the solution the same for reports?

Thanks!

The name of the control is probably DateFieldA or DateFieldB.
The name of a Control can not be the same as the name of a field used
in it's control source expression. Access gets confused.

If you always start out with an unbound control whenever you need to
write an expression, you will avoid this kind of error.
 
J

Joan Wild

Change the name of the control. From your description, you modified the
control source after adding a bound control to the form. That control will
have the name of the field it's bound to. You are now referring to that
field in your expression, and Access is confused.
 

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