Realy need help on DLOOKUP()

V

Victor Torres

I need help on this one... I have two tables and a Query. Example:

Table1 Table2
Query1
Field-A Field-B Field-B Field-C Field-A
Field-B Field-C
1 a a One 1
a One
2 b b Two 2
b Two
3 c c Three 3
c Three
4 b d .... 4
b Two
5 a e .... 5
a One

I need to create that query... Please... help
 
V

Victor Torres

Sorry this is better...

I need help on this one... I have two tables and a Query. Example:

Table1 Table2 Query
Field-A Field-B Field-B Field-C Field-A Field-B Field-C
1 a a One 1 a
One
2 b b Two 2 b
Two
3 c c Three 3 c
Three
4 b d .... 4 b
Two
5 a e .... 5 a
One

I need to create that query... Please... help
 
R

rowiga

I don't understand your question. How does this array apply to DLookup?
What are you trying to accomplish?
 
V

Victor Torres

Is that I need to create a query so if in field-b I write "c" then in another
field created inside a query like field-d show the lookup for the value "c"
that is "three". Just like the Vlookup in Excel.

:

I don't understand your question. How does this array apply to DLookup?
What are you trying to accomplish?

:

Sorry this is better...

I need help on this one... I have two tables and a Query. Example:

Table1 Table2 Query
Field-A Field-B Field-B Field-C Field-A Field-B Field-D
1 a a One 1 a
One
2 b b Two 2 b
Two
3 c c Three 3 c
Three
4 b d .... 4 b
Two
5 a e .... 5 a
One

I need to create that query... Please... help
 
R

rowiga

DLookup works with the following syntax:

=DLookup("[Field]","Location","Criteria")

FIELD is the field that you want to get information from.
LOCATION is the Table name or Query name that the field is in.
CRITERIA specifies the rules that you use to get the desired result.

I have a Contact database to log phone calls. I have a table called
tblContacts. This table stores all information about a contact. I also have a
form that I use to document the calls. On the form I have ContactName and
ContactID. ContactID is the primary key for tblContacts. When a user slects a
contact from a combo box I use DLookup to locate the contact's phone number.
It's done by:

=DLookUp("[ContactPhone]","tblContacts","[ContactID]=[Forms]![MyFormName]![ContactID]")

In other words...show me the phone number from tblContacts where the
ContactID field in the table is equal to the ContactID field on my form.
 
V

Victor Torres

Ok I understand that, but is only for forms? is only to show in the moment
the data? can't you use that formula to store data or to view the dlookup
inside the query. Not from a form?

rowiga said:
DLookup works with the following syntax:

=DLookup("[Field]","Location","Criteria")

FIELD is the field that you want to get information from.
LOCATION is the Table name or Query name that the field is in.
CRITERIA specifies the rules that you use to get the desired result.

I have a Contact database to log phone calls. I have a table called
tblContacts. This table stores all information about a contact. I also have a
form that I use to document the calls. On the form I have ContactName and
ContactID. ContactID is the primary key for tblContacts. When a user slects a
contact from a combo box I use DLookup to locate the contact's phone number.
It's done by:

=DLookUp("[ContactPhone]","tblContacts","[ContactID]=[Forms]![MyFormName]![ContactID]")

In other words...show me the phone number from tblContacts where the
ContactID field in the table is equal to the ContactID field on my form.

Victor Torres said:
Is that I need to create a query so if in field-b I write "c" then in another
field created inside a query like field-d show the lookup for the value "c"
that is "three". Just like the Vlookup in Excel.

:

I don't understand your question. How does this array apply to DLookup?
What are you trying to accomplish?

:

Sorry this is better...

I need help on this one... I have two tables and a Query. Example:

Table1 Table2 Query
Field-A Field-B Field-B Field-C Field-A Field-B Field-D
1 a a One 1 a
One
2 b b Two 2 b
Two
3 c c Three 3 c
Three
4 b d .... 4 b
Two
5 a e .... 5 a
One

I need to create that query... Please... help
 
R

rowiga

Yes it is possible to use DLookup in a query. I'm sorry that I don't fully
understand what you're trying to accomplish. I'm afraid that without a better
description of what you're doing, or someone looking at your database, you
won't get an answer to your question. You may want to try the address below
and post your question there. This site allows you to upload samples of your
database for review. It's a free forum.

http://www.utteraccess.com/

Victor Torres said:
Ok I understand that, but is only for forms? is only to show in the moment
the data? can't you use that formula to store data or to view the dlookup
inside the query. Not from a form?

rowiga said:
DLookup works with the following syntax:

=DLookup("[Field]","Location","Criteria")

FIELD is the field that you want to get information from.
LOCATION is the Table name or Query name that the field is in.
CRITERIA specifies the rules that you use to get the desired result.

I have a Contact database to log phone calls. I have a table called
tblContacts. This table stores all information about a contact. I also have a
form that I use to document the calls. On the form I have ContactName and
ContactID. ContactID is the primary key for tblContacts. When a user slects a
contact from a combo box I use DLookup to locate the contact's phone number.
It's done by:

=DLookUp("[ContactPhone]","tblContacts","[ContactID]=[Forms]![MyFormName]![ContactID]")

In other words...show me the phone number from tblContacts where the
ContactID field in the table is equal to the ContactID field on my form.

Victor Torres said:
Is that I need to create a query so if in field-b I write "c" then in another
field created inside a query like field-d show the lookup for the value "c"
that is "three". Just like the Vlookup in Excel.

:

I don't understand your question. How does this array apply to DLookup?
What are you trying to accomplish?

:

Sorry this is better...

I need help on this one... I have two tables and a Query. Example:

Table1 Table2 Query
Field-A Field-B Field-B Field-C Field-A Field-B Field-D
1 a a One 1 a
One
2 b b Two 2 b
Two
3 c c Three 3 c
Three
4 b d .... 4 b
Two
5 a e .... 5 a
One

I need to create that query... Please... help
 
A

Albert D. Kallal

You do NOT need to use dlookup here.

Just use the query builder. If you have 1 (in your case), or have 10, or
even 15 fields that are lookups to other tables, then don't bother using
dlookup, but just the query builder. The query builder is fun, you get to
use the mouse, and no code, or funny expression need be entered here. You
can do this all via the mouse....

Just drop in table1, and then drop in the other tables for the lookup
values. In your case, you only got one other table,...but you can/could drop
in 5 other tables that you need lookup values from (if you had that many
tables)..

Just use the mose to draw a join line from the main table (tale1) to the
child able. You should also make this join a "left" join (double click on
the join line, and select the option that says anything from the table on
the left side...and possible entries on the right side).

Now, just drop in fields from any of he tables...and they will display in
the query...
 
Top