By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

DLookUp

P: n/a
Hi,

I want t display several fields in one label box using the DLookUp function.
I have tried using below but all I get is '-1' when I preview the report.
Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading
Nov 13 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"Nick J" <bl*************@blueyonder.co.uk> wrote in message
news:UG*****************@fe3.news.blueyonder.co.uk ...
Hi,

I want t display several fields in one label box using the DLookUp
function. I have tried using below but all I get is '-1' when I preview
the report. Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading

I'm not sure that DLookup can be used in this manner. Why not concatenate
the fields in a query and do the DLookup on that?

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2

P: n/a
"Nick J" <bl*************@blueyonder.co.uk> wrote in message
news:UG*****************@fe3.news.blueyonder.co.uk ...
Hi,

I want t display several fields in one label box using the DLookUp
function. I have tried using below but all I get is '-1' when I preview
the report. Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")


I suppose you want to get the Company Name
together with their address.
If so try:

=DLookUp("[Company Name]","tblCompanyDetails") & " " & DLookUp("[Address
1]","tblCompanyDetails")

Bruno
Nov 13 '05 #3

P: n/a
On Fri, 22 Apr 2005 09:43:16 GMT, Nick J wrote:
Hi,

I want t display several fields in one label box using the DLookUp function.
I have tried using below but all I get is '-1' when I preview the report.
Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")


A DlookUp can only returen the value of 1 field.
Is the Company and Address your company, or is it one of many
companies?

If it is your comapnay name and address, then use:
=DLookUp("[CompanyName]","tblCompanyDetails") & chr(13) & chr(10) &
DLookUp ("[Address]","tblCompanyDetails")

Bell Company
123 Some Street

If you wish it all on one line then replace the chr(13) & chr(10) with
" " (see the next example below).

However, if the company is one of several companies in the table, you
need to use criteria to get the correct one.
=DLookUp("[CompanyName]","tblCompanyDetails","[CompanyID] = " &
someCriteria) & " " &
DLookUp("[Address]","tblCompanyDetails","[CompanyID] = " & Some
Criteria)

Joe Blow Inc. 123 Some street
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4

P: n/a
Nick J wrote:
Hi,

I want t display several fields in one label box using the DLookUp function.
I have tried using below but all I get is '-1' when I preview the report.
Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")


You're doing a Boolean expression there m8 :-)

Try
=DLookUp("[Company Name] & ' ' & [Address 1]","tblCompanyDetails")

If that don't work then try my replacement domain functions
(http://easyweb.easynet.co.uk/~trevor.../baslookup.zip) as
that'll have no problem with this syntax:

=tLookUp("[Company Name] & ' ' & [Address 1]","tblCompanyDetails")
--
[Oo=w=oO]

Nov 13 '05 #5

P: n/a
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...
Try
=DLookUp("[Company Name] & ' ' & [Address 1]","tblCompanyDetails")


It can't work!

Bruno
Nov 13 '05 #6

P: n/a
Bruno Campanini wrote:
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...

Try
=DLookUp("[Company Name] & ' ' & [Address 1]","tblCompanyDetails")

It can't work!


I wouldn't know, I've never tried it in DLookup() that's why I
recommended tLookup(), which will work like that.

--
[Oo=w=oO]

Nov 13 '05 #7

P: n/a

"Nick J" <bl*************@blueyonder.co.uk> wrote in message
news:UG*****************@fe3.news.blueyonder.co.uk ...
Hi,

I want t display several fields in one label box using the DLookUp function. I have tried using below but all I get is '-1' when I preview the report.
Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading


Build up the string just as you would in a query

DLookUp("[Company Name] & """ """ & [Address 1]","tblCompanyDetails")

Nov 13 '05 #8

P: n/a
Bruno Campanini wrote:
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...

Try
=DLookUp("[Company Name] & ' ' & [Address 1]","tblCompanyDetails")

It can't work!


Actually I just tried it in my test database:

<------
?Dlookup("[ID] & ' ' & [Wibble]","Table1")
5 gggg
------->

--
[Oo=w=oO]

Nov 13 '05 #9

P: n/a
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...
Bruno Campanini wrote:
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...

Try
=DLookUp("[Company Name] & ' ' & [Address 1]","tblCompanyDetails")

It can't work!


Actually I just tried it in my test database:

<------
?Dlookup("[ID] & ' ' & [Wibble]","Table1")
5 gggg


Yes, indeed!
I tried something like "[ID]" & " " & "[Wibble]" and
Access is unable to read two fields this way.
I'd never suppose it could do it your way.

But it does!
Surprise in Access is a never-ending story.

Bruno
Nov 13 '05 #10

P: n/a
Thats worked great, thanks for all your help.

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading
"fredg" <fg******@example.invalid> wrote in message
news:1n******************************@40tude.net.. .
On Fri, 22 Apr 2005 09:43:16 GMT, Nick J wrote:
Hi,

I want t display several fields in one label box using the DLookUp
function.
I have tried using below but all I get is '-1' when I preview the report.
Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")


A DlookUp can only returen the value of 1 field.
Is the Company and Address your company, or is it one of many
companies?

If it is your comapnay name and address, then use:
=DLookUp("[CompanyName]","tblCompanyDetails") & chr(13) & chr(10) &
DLookUp ("[Address]","tblCompanyDetails")

Bell Company
123 Some Street

If you wish it all on one line then replace the chr(13) & chr(10) with
" " (see the next example below).

However, if the company is one of several companies in the table, you
need to use criteria to get the correct one.
=DLookUp("[CompanyName]","tblCompanyDetails","[CompanyID] = " &
someCriteria) & " " &
DLookUp("[Address]","tblCompanyDetails","[CompanyID] = " & Some
Criteria)

Joe Blow Inc. 123 Some street
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #11

P: n/a
Sorry is sent this direct to Nick J
Prehaps a Text box may be better
Try =DLookUp("[Company Name]" ,tblCompanyDetails") & " " & DLookUp(
"[Address 1]","tblCompanyDetails")
This assumes u have only 1 record in tblCompanyDetails or U want the first
Record in the current sort order
If U want on 2 lines then insert vbcrlf instead " "

--
Murray Carter
"Nick J" <bl*************@blueyonder.co.uk> wrote in message
news:UG*****************@fe3.news.blueyonder.co.uk ...
Hi,

I want t display several fields in one label box using the DLookUp function. I have tried using below but all I get is '-1' when I preview the report.
Any idea's?

=DLookUp("[Company Name]" And "[Address 1]","tblCompanyDetails")

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading

Nov 13 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.