A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DLookup Function in Queries



 
 
Thread Tools Display Modes
  #1  
Old June 10th, 2004, 06:04 PM
Jim
external usenet poster
 
Posts: n/a
Default DLookup Function in Queries

What does a DLookup Function "criteria" expression in a
query look like? I'm using Access 97 and the help files
state DLookup Functions can be done within the design of
the query but it doesn't provide an example. I'm able to
create a DLookup calculated control on a form, but without
an example to look at and study, I don't know where to
start...
Thank you for your help.
  #2  
Old June 10th, 2004, 07:07 PM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default DLookup Function in Queries

It would be similar in a query. It would be used in a calculated field in a
query. Usually, you can just include the other table in the query with the
appropriate links and get the answer you need, but there are times that the
DLookup is needed.

This may be a poor example, but should give you an idea of what it looks
like. In the Field box of the query design grid, try something like:

MyCalculatedField: DLookup("[Field1]", "[Table1]", "[Field2]=" &
[Table2].[Field2])

This would use the value of Table2.Field2 of the current record to provide
criteria for the DLookup statement. In this case though, it would probably
be better just to add Table1 to the query and link Table1.Field2 to
Table2.Field2 then add Table1.Field1 to the query's output. If you don't
want to limit the records from Table2, you could use an Outer Join to do
this. I suppose that one reason to do this, would be if you already had an
outer join in the query and adding this one would create an "ambiguous outer
join", this may be a work around.

--
Wayne Morgan
Microsoft Access MVP


"Jim" wrote in message
...
What does a DLookup Function "criteria" expression in a
query look like? I'm using Access 97 and the help files
state DLookup Functions can be done within the design of
the query but it doesn't provide an example. I'm able to
create a DLookup calculated control on a form, but without
an example to look at and study, I don't know where to
start...
Thank you for your help.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.