#Name? - Killing Me

J

JudyB

I am totally lost. I have a query titled "Service Record Query" with a
calculated field - ServiceTime: DateDiff ("w",[DateIn],[DateOut]). The
calculations work correctly in the query. I have a form titled "Employees"
with a subform titled "Service Record". One of the fields in the Service
Record subform is titled "Weeks Service". I have entered:
=[ServiceRecordQuery]![ServiceTime] in the control source to pull in the data
from the calculated field in the query, but get the #Name? error. Any help
would be greatly appreciated. I know that I can put the calculation in the
form, but really wanted to use it in the query so that I can use it in other
places.
 
R

ruralguy via AccessMonster.com

You can not just point to a field in an existing static query to get the data.
The data is only available when the query is running. In this case I believe
you may need to use a DLookup() to get the value you want.
I am totally lost. I have a query titled "Service Record Query" with a
calculated field - ServiceTime: DateDiff ("w",[DateIn],[DateOut]). The
calculations work correctly in the query. I have a form titled "Employees"
with a subform titled "Service Record". One of the fields in the Service
Record subform is titled "Weeks Service". I have entered:
=[ServiceRecordQuery]![ServiceTime] in the control source to pull in the data
from the calculated field in the query, but get the #Name? error. Any help
would be greatly appreciated. I know that I can put the calculation in the
form, but really wanted to use it in the query so that I can use it in other
places.
 
B

BruceM

The query (and with it the calculated field) needs to be in the form's
Record Source. Presumably DateIn and DateOut pertain to the current subform
record, or to the current main form record, but in any case with a
connection to the record with which this calculation is to appear.
 
J

JudyB

Thank you for quick response. I had also tried using DLookup, but was not
successful with that either. I typed:
=DLookUp"[ServiceTime]","[ServiceRecordQuery]") and the end result was
#Error. Have any idea where I went wrong?
--
JudyB


ruralguy via AccessMonster.com said:
You can not just point to a field in an existing static query to get the data.
The data is only available when the query is running. In this case I believe
you may need to use a DLookup() to get the value you want.
I am totally lost. I have a query titled "Service Record Query" with a
calculated field - ServiceTime: DateDiff ("w",[DateIn],[DateOut]). The
calculations work correctly in the query. I have a form titled "Employees"
with a subform titled "Service Record". One of the fields in the Service
Record subform is titled "Weeks Service". I have entered:
=[ServiceRecordQuery]![ServiceTime] in the control source to pull in the data
from the calculated field in the query, but get the #Name? error. Any help
would be greatly appreciated. I know that I can put the calculation in the
form, but really wanted to use it in the query so that I can use it in other
places.
 
R

ruralguy via AccessMonster.com

VBA Help and this link should give you a better understanding of the Domain
function syntax. The other suggestion you received is a good one and should
be considered.

http://www.mvps.org/access/general/gen0018.htm
Thank you for quick response. I had also tried using DLookup, but was not
successful with that either. I typed:
=DLookUp"[ServiceTime]","[ServiceRecordQuery]") and the end result was
#Error. Have any idea where I went wrong?
You can not just point to a field in an existing static query to get the data.
The data is only available when the query is running. In this case I believe
[quoted text clipped - 10 lines]
 
G

Golfinray

Almost anytime you get that error, a field is missing in your query. Make
sure that filed is there and is working properly. Another thing is if your
form and subform are not linked properly. Go to the form "container" (click
 
B

BruceM

In this case I think the Control Source expression was at fault in that it
pointed to something Access couldn't identify. Even with [Queries]! in
front of it there is no way for it to identify a particular record. From
which record should it grab ServiceTime? However, if the fields are
available on the form then they are part of the record source, so in that
sense it is accurate to say the field was not in the query.

Golfinray said:
Almost anytime you get that error, a field is missing in your query. Make
sure that filed is there and is working properly. Another thing is if your
form and subform are not linked properly. Go to the form "container"
(click
I am totally lost. I have a query titled "Service Record Query" with a
calculated field - ServiceTime: DateDiff ("w",[DateIn],[DateOut]). The
calculations work correctly in the query. I have a form titled
"Employees"
with a subform titled "Service Record". One of the fields in the Service
Record subform is titled "Weeks Service". I have entered:
=[ServiceRecordQuery]![ServiceTime] in the control source to pull in the
data
from the calculated field in the query, but get the #Name? error. Any
help
would be greatly appreciated. I know that I can put the calculation in
the
form, but really wanted to use it in the query so that I can use it in
other
places.
 

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