New DLookUp problem!

N

Niklas Östergren

Hi again!

I don´t seems to get along with DLookUp today ;-(

Now I try this one (see below) but get Mish match problem.

Me.txtPhoneHome = DLookup("[tblPhoneNumber]![PhoneNo]",
"[tblPhoneNumber]", "[fkTypeOfPlaceID]=" & intPhoneTypeHomeID And
"[fkPersonID]=" & intPhoneTypeHomeID )

If I run almoste the same expression (see below) in the direct window but
change the <intPhoneTypeHomeID> and <intPhoneTypeHomeID > to numbers
instead, like this:

DLookup("[tblPhoneNumber]![PhoneNo]", "[tblPhoneNumber]",
"[fkTypeOfPlaceID]=1 And [fkPersonID]= 3")

Then I get the answer I want!

Any idéas???

TIA!

// Niklas
 
R

Rick Brandt

Niklas Östergren said:
Hi again!

I don´t seems to get along with DLookUp today ;-(

Now I try this one (see below) but get Mish match problem.

Me.txtPhoneHome = DLookup("[tblPhoneNumber]![PhoneNo]",
"[tblPhoneNumber]", "[fkTypeOfPlaceID]=" & intPhoneTypeHomeID And
"[fkPersonID]=" & intPhoneTypeHomeID )

You don't need the table qualifier in argument 1 because that is already
supplied by argument 2. Also, your "And" is outside the quotes and needs to be
inside them.

DLookup("[PhoneNo]","[tblPhoneNumber]", "[fkTypeOfPlaceID]=" &
intPhoneTypeHomeID" & " And [fkPersonID]=" & intPhoneTypeHomeID & "")
 
N

Niklas Östergren

Hmm!

I tryed that but got some error:

"Expected: <various>!
....An expected part of the syntax was not found.

And ("&") is marked in the part (intPhoneTypeHomeID "&" And [fkPersonID]).

Any ideas?

Thanks a lot for taking time!

// Niklas



Rick Brandt said:
Niklas Östergren said:
Hi again!

I don´t seems to get along with DLookUp today ;-(

Now I try this one (see below) but get Mish match problem.

Me.txtPhoneHome = DLookup("[tblPhoneNumber]![PhoneNo]",
"[tblPhoneNumber]", "[fkTypeOfPlaceID]=" & intPhoneTypeHomeID And
"[fkPersonID]=" & intPhoneTypeHomeID )

You don't need the table qualifier in argument 1 because that is already
supplied by argument 2. Also, your "And" is outside the quotes and needs to be
inside them.

DLookup("[PhoneNo]","[tblPhoneNumber]", "[fkTypeOfPlaceID]=" &
intPhoneTypeHomeID" & " And [fkPersonID]=" & intPhoneTypeHomeID & "")
 
D

Dave

Try this

DLookup("[PhoneNo]","[tblPhoneNumber]", "[fkTypeOfPlaceID]=" &
intPhoneTypeHomeID & " And [fkPersonID]=" & intPhoneTypeHomeID)


Niklas Östergren said:
Hmm!

I tryed that but got some error:

"Expected: <various>!
...An expected part of the syntax was not found.

And ("&") is marked in the part (intPhoneTypeHomeID "&" And [fkPersonID]).

Any ideas?

Thanks a lot for taking time!

// Niklas



Rick Brandt said:
Niklas Östergren said:
Hi again!

I don´t seems to get along with DLookUp today ;-(

Now I try this one (see below) but get Mish match problem.

Me.txtPhoneHome = DLookup("[tblPhoneNumber]![PhoneNo]",
"[tblPhoneNumber]", "[fkTypeOfPlaceID]=" & intPhoneTypeHomeID And
"[fkPersonID]=" & intPhoneTypeHomeID )

You don't need the table qualifier in argument 1 because that is already
supplied by argument 2. Also, your "And" is outside the quotes and
needs
to be
inside them.

DLookup("[PhoneNo]","[tblPhoneNumber]", "[fkTypeOfPlaceID]=" &
intPhoneTypeHomeID" & " And [fkPersonID]=" & intPhoneTypeHomeID & "")
 
N

Niklas Östergren

Thanks a lot Dave!

It worked!

// Niklas


Dave said:
Try this

DLookup("[PhoneNo]","[tblPhoneNumber]", "[fkTypeOfPlaceID]=" &
intPhoneTypeHomeID & " And [fkPersonID]=" & intPhoneTypeHomeID)


Niklas Östergren said:
Hmm!

I tryed that but got some error:

"Expected: <various>!
...An expected part of the syntax was not found.

And ("&") is marked in the part (intPhoneTypeHomeID "&" And [fkPersonID]).

Any ideas?

Thanks a lot for taking time!

// Niklas



Rick Brandt said:
Hi again!

I don´t seems to get along with DLookUp today ;-(

Now I try this one (see below) but get Mish match problem.

Me.txtPhoneHome = DLookup("[tblPhoneNumber]![PhoneNo]",
"[tblPhoneNumber]", "[fkTypeOfPlaceID]=" & intPhoneTypeHomeID And
"[fkPersonID]=" & intPhoneTypeHomeID )

You don't need the table qualifier in argument 1 because that is already
supplied by argument 2. Also, your "And" is outside the quotes and
needs
to be
inside them.

DLookup("[PhoneNo]","[tblPhoneNumber]", "[fkTypeOfPlaceID]=" &
intPhoneTypeHomeID" & " And [fkPersonID]=" & intPhoneTypeHomeID & "")
 

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

Similar Threads

Problem with filling DatasheetForm / ContiniusForm 3
DLookUp (I don´t get it!) 5
Adding/editing problem 7
Dlookup error 4
DLookUp 7
Dlookup - msgbox 4
DLookup 4
DLookUp for an Alphanumeric Record 3

Top