DLookUp

L

ldmcfall

Hi, I am having a problem with my DLookup on my report. I have a table that
is BranchName1 and the fields in this table are Station and BranchName. In
this table it tells me which teller has done a transaction by knowing that a
certain station number belongs to a certain branch. For example: if the
station number is 1234 that is a teller at our main branch, if it is 1356 it
is a teller at our East branch. On my report I need to look up this
information in the table so that it will put the right Branch Name on the
report depending on the Station. This is what I have wrote:
=DLookUp("[BranchName]","BranchName1","[Station]=[Station]").

On my report it seems to be going to the table but the only branch it will
give me is Main Branch no matter what the station number is. There are four
branches I need, Main Branch, East Branch, Saratoga, and Hanna.
Any Help would be great.
Thanks.
 
J

Jeff Boyce

It sounds like you've decided that using DLookup() is your solution.

If you create a query, add the Transaction table and the BranchName1 table,
joined on [Station], you can include [BranchName] as one of your output
fields.

Then, base your report on the query, not the table.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
V

Van T. Dinh

Usually, the problem is in the citeria:

"[Station]=[Station]"

The first [Station] correctly refers to the Field name in the Table / Domain
and should be enclosed by double-quote. The second [Station] normally
refers to a Field (?) VALUE that needs to be supplied to the DLookUp()
function to find a matching Record. If this is the case, it needs to be
outside the double-quotes.

Assume that [Station] is numeric and included in the RecordSource of your
Report, you can try:

=DLookUp("[BranchName]","BranchName1","[Station] = " & [Station])

Alternatively, you can include the Table "BranchName1 in the RecordSource of
the Report joined properly to other Tables in the RecordSource to idetify
the BranchName required, include BranchName in the selection list and in
this case, BranchName value will be available to the Report like other
Fields.
 
D

Duane Hookom

Van,
Good to see you back posting.

--
Duane Hookom
MS Access MVP

Van T. Dinh said:
Usually, the problem is in the citeria:

"[Station]=[Station]"

The first [Station] correctly refers to the Field name in the Table /
Domain and should be enclosed by double-quote. The second [Station]
normally refers to a Field (?) VALUE that needs to be supplied to the
DLookUp() function to find a matching Record. If this is the case, it
needs to be outside the double-quotes.

Assume that [Station] is numeric and included in the RecordSource of your
Report, you can try:

=DLookUp("[BranchName]","BranchName1","[Station] = " & [Station])

Alternatively, you can include the Table "BranchName1 in the RecordSource
of the Report joined properly to other Tables in the RecordSource to
idetify the BranchName required, include BranchName in the selection list
and in this case, BranchName value will be available to the Report like
other Fields.

--
HTH
Van T. Dinh
MVP (Access)



ldmcfall said:
Hi, I am having a problem with my DLookup on my report. I have a table
that
is BranchName1 and the fields in this table are Station and BranchName.
In
this table it tells me which teller has done a transaction by knowing
that a
certain station number belongs to a certain branch. For example: if the
station number is 1234 that is a teller at our main branch, if it is 1356
it
is a teller at our East branch. On my report I need to look up this
information in the table so that it will put the right Branch Name on the
report depending on the Station. This is what I have wrote:
=DLookUp("[BranchName]","BranchName1","[Station]=[Station]").

On my report it seems to be going to the table but the only branch it
will
give me is Main Branch no matter what the station number is. There are
four
branches I need, Main Branch, East Branch, Saratoga, and Hanna.
Any Help would be great.
Thanks.
 
J

Jeff Boyce

Welcome back, Van!

Jeff

Van T. Dinh said:
Usually, the problem is in the citeria:

"[Station]=[Station]"

The first [Station] correctly refers to the Field name in the Table /
Domain and should be enclosed by double-quote. The second [Station]
normally refers to a Field (?) VALUE that needs to be supplied to the
DLookUp() function to find a matching Record. If this is the case, it
needs to be outside the double-quotes.

Assume that [Station] is numeric and included in the RecordSource of your
Report, you can try:

=DLookUp("[BranchName]","BranchName1","[Station] = " & [Station])

Alternatively, you can include the Table "BranchName1 in the RecordSource
of the Report joined properly to other Tables in the RecordSource to
idetify the BranchName required, include BranchName in the selection list
and in this case, BranchName value will be available to the Report like
other Fields.

--
HTH
Van T. Dinh
MVP (Access)



ldmcfall said:
Hi, I am having a problem with my DLookup on my report. I have a table
that
is BranchName1 and the fields in this table are Station and BranchName.
In
this table it tells me which teller has done a transaction by knowing
that a
certain station number belongs to a certain branch. For example: if the
station number is 1234 that is a teller at our main branch, if it is 1356
it
is a teller at our East branch. On my report I need to look up this
information in the table so that it will put the right Branch Name on the
report depending on the Station. This is what I have wrote:
=DLookUp("[BranchName]","BranchName1","[Station]=[Station]").

On my report it seems to be going to the table but the only branch it
will
give me is Main Branch no matter what the station number is. There are
four
branches I need, Main Branch, East Branch, Saratoga, and Hanna.
Any Help would be great.
Thanks.
 

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