DateDiff Troubles

  • Thread starter Thread starter Marie
  • Start date Start date
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!
 
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.
 
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.
 
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.
 
Back
Top