Date field in a subform displaying #Name?

  • Thread starter Thread starter Bill Murphy
  • Start date Start date
B

Bill Murphy

In a table in my application I have a date field named DateDead. I also
have other date fields in this table, all formatted as Short Date. In a
query the DateDead field displays the short date value as expected. When I
use this same query as a row source for a datasheet used as a sub-form this
field displays #Name? instead of the date value. I've tried removing the
field from the form, then re-adding it. I've also tried removing DateDead
from the query and later re-adding it, but with the same results. All of
the other date fields display normally in the sub-form.

If I open the datasheet sub-form by itself outside the application DateDead
displays normally.

I would appreciate any thoughts on a solution.

Bill
 
#Name? error shows when
- there is a control named DateDead and there is a field named DateDead,
but that control is not bound to that field.
- the reference to the DateDead control includes the form name (e.g.,
[Forms]![FormName]![DateDead], but you're using the form as a subform so the
reference is incorrect because the form is not open as a separate form so
it's not part of the Forms collection.
- you have a function named DateDead in your project as well as the
control and/or field named DateDead.
- you have more than one DateDead field in the query and you're not
fully referencing which table it's from within that query.

You'll need to post more details, such as the SQL statement of the record
source for the form (note: a form has a record source; a combo box or a list
box has a row source).
 
In a table in my application I have a date field named DateDead. I also
have other date fields in this table, all formatted as Short Date. In a
query the DateDead field displays the short date value as expected. When I
use this same query as a row source for a datasheet used as a sub-form this
field displays #Name? instead of the date value. I've tried removing the
field from the form, then re-adding it. I've also tried removing DateDead
from the query and later re-adding it, but with the same results. All of
the other date fields display normally in the sub-form.

If I open the datasheet sub-form by itself outside the application DateDead
displays normally.

I would appreciate any thoughts on a solution.

Do you have some control - textbox or other - on either this subform
or the mainform also named DateDead? Access may be getting confused
about which you mean. If you have a textbox (even one bound to
[DateDead]) try renaming it to txtDateDead.

Also, doublecheck that the Subform's Recordsource property in fact
includes this field... otherwise you're dead out of luck! <g>

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Ken and John,

I appreciate your help on this. I stepped through my code and found that
the dates in this column of the datasheet were visible, but when I set the
form recordsource a second time the #Name? was displayed. I remarked out
the second occurrence and the dates displayed okay. I'm not sure why this
resolved the problem, but I'll go with the results. Thanks again.

Bill
 
Back
Top