Query Referencing

M

Midland

I am working with the following expression in my query:

QSetUpNum: DLookUp("[DataLink]![SetupNum]","[DataLink]","[PN]")

The query name is InQry, the Datalink table is a reference for production
set up and completion rates. "PN" is a field name in InQry. I get the
impression that an aggregrate function in expression cannot refer to another
field in the same query, expect that this is not a restriction I can find
anywhere in my reference material. No matter what I put in that third
argument, I get the "cannot find the name" error message. What am I missing?
 
J

Jeff Boyce

If I'm understanding your description, you are trying to use DLookup() to
find a value in a query. Where's the name of the query in the DLookup()
expression?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

Chegu Tom

The third parameter requires a logical expression. Is PN a boolean
(logical) field? If it is text or numer you need to have +,<,>, or Like
operators

If setupNum is a field in your DataLink table then you don't need the
[DataLink]! in the first parameter
 
M

Midland

Oversimplified a bit, but, making the criteria complete, the expression
should read:

QSetUpNum:
DLookUp("[DataLink]![SetupNum]","[DataLink]","[Datalink]![RateID]=[InQry]![QRateID]")

No matter how I tweak it, it still refuses to recognize the name QRateID,
which is a field in the same query. However, I have tried a criteria from the
original data table, and random fields. The expression won't recognize
anything but a constant, which isn't of any use. I feel I am making some
elementary typing error, here, but I have no idea what it is.

--
Midland


Jeff Boyce said:
If I'm understanding your description, you are trying to use DLookup() to
find a value in a query. Where's the name of the query in the DLookup()
expression?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Midland said:
I am working with the following expression in my query:

QSetUpNum: DLookUp("[DataLink]![SetupNum]","[DataLink]","[PN]")

The query name is InQry, the Datalink table is a reference for production
set up and completion rates. "PN" is a field name in InQry. I get the
impression that an aggregrate function in expression cannot refer to
another
field in the same query, expect that this is not a restriction I can find
anywhere in my reference material. No matter what I put in that third
argument, I get the "cannot find the name" error message. What am I
missing?
 
J

Jeff Boyce

I may be mis-remembering the syntax, but if you are looking for a value that
is IN the query, you need to start with that, not end with it. Have you
confimed that the syntax you are using matches what you find in Access HELP?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Midland said:
Oversimplified a bit, but, making the criteria complete, the expression
should read:

QSetUpNum:
DLookUp("[DataLink]![SetupNum]","[DataLink]","[Datalink]![RateID]=[InQry]![QRateID]")

No matter how I tweak it, it still refuses to recognize the name QRateID,
which is a field in the same query. However, I have tried a criteria from
the
original data table, and random fields. The expression won't recognize
anything but a constant, which isn't of any use. I feel I am making some
elementary typing error, here, but I have no idea what it is.

--
Midland


Jeff Boyce said:
If I'm understanding your description, you are trying to use DLookup() to
find a value in a query. Where's the name of the query in the DLookup()
expression?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Midland said:
I am working with the following expression in my query:

QSetUpNum: DLookUp("[DataLink]![SetupNum]","[DataLink]","[PN]")

The query name is InQry, the Datalink table is a reference for
production
set up and completion rates. "PN" is a field name in InQry. I get the
impression that an aggregrate function in expression cannot refer to
another
field in the same query, expect that this is not a restriction I can
find
anywhere in my reference material. No matter what I put in that third
argument, I get the "cannot find the name" error message. What am I
missing?
 

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