Dlookup problem

J

Jean-Paul

=DLookUp([Naam_bedrijf];[Afspraken];[Aankomst]=800)

returns a #Name error

I use a Dutch version of Access
I rewrote teh fieldname-tablename 1000 times, nothing changes?

What's wrong?
 
A

Allen Browne

Use quotes around the expressions.

You might also try commas instead of semicolons.
=DLookUp("Naam_bedrijf", "Afspraken", "Aankomst = 800")

If Aankomst is a Text field (not a Number field), you need extra quotes:
=DLookUp("Naam_bedrijf", "Afspraken", "Aankomst = ""800""")
Explanation in:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html
 
R

RonaldoOneNil

Dlookup takes string parameters
=DLookUp("[Naam_bedrijf]","[Afspraken]","[Aankomst]=800")
 
J

Jean-Paul

Great...
I need to add a date field to...
What should be the correct syntax?
I thought:
=DLookUp("[Naam_bedrijf]","[Afspraken]","[Aankomst]=800 AND
[Datum_afspraak]=#15/01/09#")

but doesn't seem to work.

Thanks

Dlookup takes string parameters
=DLookUp("[Naam_bedrijf]","[Afspraken]","[Aankomst]=800")

Jean-Paul said:
=DLookUp([Naam_bedrijf];[Afspraken];[Aankomst]=800)

returns a #Name error

I use a Dutch version of Access
I rewrote teh fieldname-tablename 1000 times, nothing changes?

What's wrong?
 
J

Jean-Paul

I checked the website you suggested.

They talk about another function: Elookup() and talk about:

Note that ELookup() requires a reference to the DAO library

This is a bit confusing... I don't understand how?
Any help is welcome
Thanks
JP
 
J

Jean-Paul

I also tried:

=DLookUp("[Naam_bedrijf]";"[Afspraken]";"[Datum_bezoek]=#me!maandag#")

where me!maandag is a field on my form containing a date
I think the syntax isn't correct
Dlookup takes string parameters
=DLookUp("[Naam_bedrijf]","[Afspraken]","[Aankomst]=800")

Jean-Paul said:
=DLookUp([Naam_bedrijf];[Afspraken];[Aankomst]=800)

returns a #Name error

I use a Dutch version of Access
I rewrote teh fieldname-tablename 1000 times, nothing changes?

What's wrong?
 
A

Allen Browne

There is an alternative ELookup() if you want to code your own, but it is
not referred to on the page about using quotes within quotes.

There is more information about DLookup() here:
http://allenbrowne.com/casu-07.html
That page mentions the alternative as an afterthought, but explains how to
use DLookup().

DLookup() is worth your time to learn it.
 
J

Jean-Paul

They are talking about a better ELookUp....

I tried following syntax without succes:

=DLookUp("[Naam_bedrijf]";"[Afspraken]";"[Datum_bezoek]= #" &
Format([Forms!Bedrijven![Maandag];"DD/MM/YYYY") & "#")

What is wrong?
 
J

Jean-Paul

OK Guys... it works..

This is my final syntax:

=DLookUp("[Naam_bedrijf]";"[Afspraken]";"[Datum_bezoek]= #" &
Format([Formulieren]![Bedrijven]![knop13].[Caption];"MM/DD/YYYY") & "#
AND [Aankomst]=800")

Another question...

it would be nice to have the background of the field in another colour
when data are found.... is there a way?
Thanks

Jean-Paul said:
They are talking about a better ELookUp....

I tried following syntax without succes:

=DLookUp("[Naam_bedrijf]";"[Afspraken]";"[Datum_bezoek]= #" &
Format([Forms!Bedrijven![Maandag];"DD/MM/YYYY") & "#")

What is wrong?

Allen said:
There is an alternative ELookup() if you want to code your own, but it
is not referred to on the page about using quotes within quotes.

There is more information about DLookup() here:
http://allenbrowne.com/casu-07.html
That page mentions the alternative as an afterthought, but explains
how to use DLookup().

DLookup() is worth your time to learn it.
 
J

Jean-Paul

OK Guys... it works..

This is my final syntax:

=DLookUp("[Naam_bedrijf]";"[Afspraken]";"[Datum_bezoek]= #" &
Format([Formulieren]![Bedrijven]![knop13].[Caption];"MM/DD/YYYY") & "#
AND [Aankomst]=800")

Another question...

it would be nice to have the background of the field in another colour
when data are found.... is there a way?
Thanks
Dlookup takes string parameters
=DLookUp("[Naam_bedrijf]","[Afspraken]","[Aankomst]=800")

Jean-Paul said:
=DLookUp([Naam_bedrijf];[Afspraken];[Aankomst]=800)

returns a #Name error

I use a Dutch version of Access
I rewrote teh fieldname-tablename 1000 times, nothing changes?

What's wrong?
 

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