New DLookUp problem!

  • Thread starter Thread starter Niklas Östergren
  • Start date Start date
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
 
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 & "")
 
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 & "")
 
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 & "")
 
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 & "")
 
Back
Top