Text box displaying result from a query

  • Thread starter Thread starter jon
  • Start date Start date
J

jon

Hi
On a form the user selects a part No in a combo box, else where on that form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results are
correct but when I select the new text box in input in the control source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
Jon,

If your query only returns one record, and is not bound to your form, then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
 
Hi Dale

It comes back with a #error

I have also tried the following
=DLookUp("[Componet short Name]","Qu-JobSelection",[Componet
No]=[Cmb-slectJob])
and that comes back with the #name?
but I will have to leave this now for a week as I have to do a couple of
other things on the database now.

Thanks for the help

Jon


Dale Fye said:
Jon,

If your query only returns one record, and is not bound to your form, then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



jon said:
Hi
On a form the user selects a part No in a combo box, else where on that
form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results are
correct but when I select the new text box in input in the control source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
Jon,

the format for the DLOOKUP is:

DLOOKUP("FieldName", "TableOrQueryName", strCriteria)

1. Are you sure you have the Fieldname entered correctly (Componet instead
of Component?).

2. Are you sure that the query name is correct?

3. The criteria must be in a string format, so it might look like:

=DLOOKUP("Component short name", "qu-JobSelection", "Component No = " &
me.cmb-SelectJob)

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



jon said:
Hi Dale

It comes back with a #error

I have also tried the following
=DLookUp("[Componet short Name]","Qu-JobSelection",[Componet
No]=[Cmb-slectJob])
and that comes back with the #name?
but I will have to leave this now for a week as I have to do a couple of
other things on the database now.

Thanks for the help

Jon


Dale Fye said:
Jon,

If your query only returns one record, and is not bound to your form, then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



jon said:
Hi
On a form the user selects a part No in a combo box, else where on that
form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results are
correct but when I select the new text box in input in the control source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
Hi Dale

still no luck

what I have in the control source now is
=DLookUp("CompName","Qu-JobSelectFrmCompAnnalisi","CompNo = " &
[Cmb-slectJob])

when I run the following query the results are correct and it is this is
what I am after.

SELECT [Qu-JobSelection].[Componet short Name] AS compName,
[Qu-JobSelection].Frame, [Qu-JobSelection].[Componet No] AS CompNo
FROM [Qu-JobSelection]
WHERE ((([Qu-JobSelection].[Componet
No])=[Forms]![Frm-Componet-Annalisis]![Cmb-slectJob]));


the form is called: Frm-Componet-Annalisis
the combo box where which the query checks against is: Cmb-slectJob
the text box where the result is going is: Text97
the control source is above but obviously wrong for what ever reason.

The query is called Qu-JobSelectFrmCompAnnalisi
I am after ether the field compName or Frame
as once I have got one even I should be able to get the other.

thanks
Jon



Dale Fye said:
Jon,

the format for the DLOOKUP is:

DLOOKUP("FieldName", "TableOrQueryName", strCriteria)

1. Are you sure you have the Fieldname entered correctly (Componet
instead
of Component?).

2. Are you sure that the query name is correct?

3. The criteria must be in a string format, so it might look like:

=DLOOKUP("Component short name", "qu-JobSelection", "Component No = " &
me.cmb-SelectJob)

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



jon said:
Hi Dale

It comes back with a #error

I have also tried the following
=DLookUp("[Componet short Name]","Qu-JobSelection",[Componet
No]=[Cmb-slectJob])
and that comes back with the #name?
but I will have to leave this now for a week as I have to do a couple of
other things on the database now.

Thanks for the help

Jon


Dale Fye said:
Jon,

If your query only returns one record, and is not bound to your form,
then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Hi
On a form the user selects a part No in a combo box, else where on
that
form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results are
correct but when I select the new text box in input in the control
source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
The problem may be that you've got a special character (the minus sign) in
the query name. Try

=DLookUp("CompName","[Qu-JobSelectFrmCompAnnalisi]","CompNo = " &
[Cmb-slectJob])

In general, most of us recommend not using any special characters (including
spaces) in names.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jon said:
Hi Dale

still no luck

what I have in the control source now is
=DLookUp("CompName","Qu-JobSelectFrmCompAnnalisi","CompNo = " &
[Cmb-slectJob])

when I run the following query the results are correct and it is this is
what I am after.

SELECT [Qu-JobSelection].[Componet short Name] AS compName,
[Qu-JobSelection].Frame, [Qu-JobSelection].[Componet No] AS CompNo
FROM [Qu-JobSelection]
WHERE ((([Qu-JobSelection].[Componet
No])=[Forms]![Frm-Componet-Annalisis]![Cmb-slectJob]));


the form is called: Frm-Componet-Annalisis
the combo box where which the query checks against is: Cmb-slectJob
the text box where the result is going is: Text97
the control source is above but obviously wrong for what ever reason.

The query is called Qu-JobSelectFrmCompAnnalisi
I am after ether the field compName or Frame
as once I have got one even I should be able to get the other.

thanks
Jon



Dale Fye said:
Jon,

the format for the DLOOKUP is:

DLOOKUP("FieldName", "TableOrQueryName", strCriteria)

1. Are you sure you have the Fieldname entered correctly (Componet
instead
of Component?).

2. Are you sure that the query name is correct?

3. The criteria must be in a string format, so it might look like:

=DLOOKUP("Component short name", "qu-JobSelection", "Component No = " &
me.cmb-SelectJob)

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



jon said:
Hi Dale

It comes back with a #error

I have also tried the following
=DLookUp("[Componet short Name]","Qu-JobSelection",[Componet
No]=[Cmb-slectJob])
and that comes back with the #name?
but I will have to leave this now for a week as I have to do a couple of
other things on the database now.

Thanks for the help

Jon


Jon,

If your query only returns one record, and is not bound to your form,
then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Hi
On a form the user selects a part No in a combo box, else where on
that
form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results are
correct but when I select the new text box in input in the control
source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
Sorted.
what was wrong was the query filtered on the same data as the dlookup was.

As for using special characters I am now in agreement as I saw a few
problems whilst doing this.
Also Dale said "rate the post" how is this done?

Thanks

Jon


Douglas J. Steele said:
The problem may be that you've got a special character (the minus sign) in
the query name. Try

=DLookUp("CompName","[Qu-JobSelectFrmCompAnnalisi]","CompNo = " &
[Cmb-slectJob])

In general, most of us recommend not using any special characters
(including spaces) in names.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jon said:
Hi Dale

still no luck

what I have in the control source now is
=DLookUp("CompName","Qu-JobSelectFrmCompAnnalisi","CompNo = " &
[Cmb-slectJob])

when I run the following query the results are correct and it is this is
what I am after.

SELECT [Qu-JobSelection].[Componet short Name] AS compName,
[Qu-JobSelection].Frame, [Qu-JobSelection].[Componet No] AS CompNo
FROM [Qu-JobSelection]
WHERE ((([Qu-JobSelection].[Componet
No])=[Forms]![Frm-Componet-Annalisis]![Cmb-slectJob]));


the form is called: Frm-Componet-Annalisis
the combo box where which the query checks against is: Cmb-slectJob
the text box where the result is going is: Text97
the control source is above but obviously wrong for what ever reason.

The query is called Qu-JobSelectFrmCompAnnalisi
I am after ether the field compName or Frame
as once I have got one even I should be able to get the other.

thanks
Jon



Dale Fye said:
Jon,

the format for the DLOOKUP is:

DLOOKUP("FieldName", "TableOrQueryName", strCriteria)

1. Are you sure you have the Fieldname entered correctly (Componet
instead
of Component?).

2. Are you sure that the query name is correct?

3. The criteria must be in a string format, so it might look like:

=DLOOKUP("Component short name", "qu-JobSelection", "Component No = " &
me.cmb-SelectJob)

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Hi Dale

It comes back with a #error

I have also tried the following
=DLookUp("[Componet short Name]","Qu-JobSelection",[Componet
No]=[Cmb-slectJob])
and that comes back with the #name?
but I will have to leave this now for a week as I have to do a couple
of
other things on the database now.

Thanks for the help

Jon


Jon,

If your query only returns one record, and is not bound to your form,
then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Hi
On a form the user selects a part No in a combo box, else where on
that
form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results
are
correct but when I select the new text box in input in the control
source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
Jon,

If you are using Microsofts web interface to get to the newsgroups, there is
a button on the bottom right of the page that allows you to indicate whether
the post was helpful or not. If you are using Outlook Express, there is no
way to do so. If you are using some other web interface to the newsgroups,
they may or may not have a way to rate the post.

Glad we could help.

jon said:
Sorted.
what was wrong was the query filtered on the same data as the dlookup was.

As for using special characters I am now in agreement as I saw a few
problems whilst doing this.
Also Dale said "rate the post" how is this done?

Thanks

Jon


Douglas J. Steele said:
The problem may be that you've got a special character (the minus sign)
in the query name. Try

=DLookUp("CompName","[Qu-JobSelectFrmCompAnnalisi]","CompNo = " &
[Cmb-slectJob])

In general, most of us recommend not using any special characters
(including spaces) in names.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jon said:
Hi Dale

still no luck

what I have in the control source now is
=DLookUp("CompName","Qu-JobSelectFrmCompAnnalisi","CompNo = " &
[Cmb-slectJob])

when I run the following query the results are correct and it is this is
what I am after.

SELECT [Qu-JobSelection].[Componet short Name] AS compName,
[Qu-JobSelection].Frame, [Qu-JobSelection].[Componet No] AS CompNo
FROM [Qu-JobSelection]
WHERE ((([Qu-JobSelection].[Componet
No])=[Forms]![Frm-Componet-Annalisis]![Cmb-slectJob]));


the form is called: Frm-Componet-Annalisis
the combo box where which the query checks against is: Cmb-slectJob
the text box where the result is going is: Text97
the control source is above but obviously wrong for what ever reason.

The query is called Qu-JobSelectFrmCompAnnalisi
I am after ether the field compName or Frame
as once I have got one even I should be able to get the other.

thanks
Jon



Jon,

the format for the DLOOKUP is:

DLOOKUP("FieldName", "TableOrQueryName", strCriteria)

1. Are you sure you have the Fieldname entered correctly (Componet
instead
of Component?).

2. Are you sure that the query name is correct?

3. The criteria must be in a string format, so it might look like:

=DLOOKUP("Component short name", "qu-JobSelection", "Component No = " &
me.cmb-SelectJob)

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Hi Dale

It comes back with a #error

I have also tried the following
=DLookUp("[Componet short Name]","Qu-JobSelection",[Componet
No]=[Cmb-slectJob])
and that comes back with the #name?
but I will have to leave this now for a week as I have to do a couple
of
other things on the database now.

Thanks for the help

Jon


Jon,

If your query only returns one record, and is not bound to your
form, then
try:

=DLOOKUP("Componet short Name", "Qu-JobSelectFrmCompAnnalisi")

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

Hi
On a form the user selects a part No in a combo box, else where on
that
form
I want to use related fields to show information.
I have made a query that filters on the combo box and the results
are
correct but when I select the new text box in input in the control
source
"=[Qu-JobSelectFrmCompAnnalisi]![Componet short Name]"
all I get displayed is #Name?

What am I doing wrong to get it to display the data I want?

I am using access 97 , any advise is welcome.

Thanks
Jon
 
Back
Top