Dlookup syntax in a subform

G

Guest

In advance, I appreciate any help anyone can give me on this issue. Here is
my dilemma. I have a form named "WO" and a subform within "WO" named "WO
Detail". In the subform, I have a control named "Work to be done" that is a
lookup of a table named "Repair Instructions". When an item is selected in
"Work to be done", I want a control in the subform named "Time" to be
updated. "Time" is also the name of the field in the table "Repair
Instructions" that I want to display on the subform. My current dlookup
function is as follows:

=DLookUp("[TIME]","[REPAIR INSTRUCTIONS]","[INSTRUCTION]='" &
[Forms]![WO]![WO Detail]![Work to be done] & "'")

The error I am receiving is #Name?. I can hard code the "INSTRUCTION" to
equal one of the the instructions and I get exactly the right answer. So, I
know the syntax is off somewhere.
 
G

Guest

Ken,
Thanks so much for the help. It works great.
--
Jeff


Ken Snell (MVP) said:
Perhaps you can use the setup described in this article -- it'll be easier
and avoids the need for the DLookup function:
http://www.mvps.org/access/forms/frm0058.htm
--

Ken Snell
<MS ACCESS MVP>


Jeff said:
In advance, I appreciate any help anyone can give me on this issue. Here
is
my dilemma. I have a form named "WO" and a subform within "WO" named "WO
Detail". In the subform, I have a control named "Work to be done" that is
a
lookup of a table named "Repair Instructions". When an item is selected
in
"Work to be done", I want a control in the subform named "Time" to be
updated. "Time" is also the name of the field in the table "Repair
Instructions" that I want to display on the subform. My current dlookup
function is as follows:

=DLookUp("[TIME]","[REPAIR INSTRUCTIONS]","[INSTRUCTION]='" &
[Forms]![WO]![WO Detail]![Work to be done] & "'")

The error I am receiving is #Name?. I can hard code the "INSTRUCTION" to
equal one of the the instructions and I get exactly the right answer. So,
I
know the syntax is off somewhere.
 
G

Guest

Ken,
One additional question, I noticed that this method does not update the
table and I need to print this data. Any ideas?
--
Jeff


Ken Snell (MVP) said:
Perhaps you can use the setup described in this article -- it'll be easier
and avoids the need for the DLookup function:
http://www.mvps.org/access/forms/frm0058.htm
--

Ken Snell
<MS ACCESS MVP>


Jeff said:
In advance, I appreciate any help anyone can give me on this issue. Here
is
my dilemma. I have a form named "WO" and a subform within "WO" named "WO
Detail". In the subform, I have a control named "Work to be done" that is
a
lookup of a table named "Repair Instructions". When an item is selected
in
"Work to be done", I want a control in the subform named "Time" to be
updated. "Time" is also the name of the field in the table "Repair
Instructions" that I want to display on the subform. My current dlookup
function is as follows:

=DLookUp("[TIME]","[REPAIR INSTRUCTIONS]","[INSTRUCTION]='" &
[Forms]![WO]![WO Detail]![Work to be done] & "'")

The error I am receiving is #Name?. I can hard code the "INSTRUCTION" to
equal one of the the instructions and I get exactly the right answer. So,
I
know the syntax is off somewhere.
 
K

Ken Snell \(MVP\)

See the second option on that article. It tells how to put the value from a
combo box column into a textbox that is bound to a field.

--

Ken Snell
<MS ACCESS MVP>


Jeff said:
Ken,
One additional question, I noticed that this method does not update the
table and I need to print this data. Any ideas?
--
Jeff


Ken Snell (MVP) said:
Perhaps you can use the setup described in this article -- it'll be
easier
and avoids the need for the DLookup function:
http://www.mvps.org/access/forms/frm0058.htm
--

Ken Snell
<MS ACCESS MVP>


Jeff said:
In advance, I appreciate any help anyone can give me on this issue.
Here
is
my dilemma. I have a form named "WO" and a subform within "WO" named
"WO
Detail". In the subform, I have a control named "Work to be done" that
is
a
lookup of a table named "Repair Instructions". When an item is
selected
in
"Work to be done", I want a control in the subform named "Time" to be
updated. "Time" is also the name of the field in the table "Repair
Instructions" that I want to display on the subform. My current
dlookup
function is as follows:

=DLookUp("[TIME]","[REPAIR INSTRUCTIONS]","[INSTRUCTION]='" &
[Forms]![WO]![WO Detail]![Work to be done] & "'")

The error I am receiving is #Name?. I can hard code the "INSTRUCTION"
to
equal one of the the instructions and I get exactly the right answer.
So,
I
know the syntax is off somewhere.
 

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