dlookup prob

F

faberk

Im not sure why this dlookup is not working. When i add the AND to my
conditions i return an error 13-type mismatch.

intFeb = DLookup("[FEB]", "[qryLabourDataInquiry]", "[ChildCCtr] = '" &
strCCtr & "'" And "[ChildId] = 97")

The variable strCCtr is a string and intFeb is decalred as a double. The
ChildId field in the query is an long integer. They work independently of
each othger, but return the 13 error msg when used together.

Thanks
 
K

Ken Snell [MVP]

You have too many " characters:

intFeb = DLookup("[FEB]", "[qryLabourDataInquiry]", "[ChildCCtr] = '" &
strCCtr & "' And [ChildId] = 97")
 
F

faberk

Thanks.

Ken Snell said:
You have too many " characters:

intFeb = DLookup("[FEB]", "[qryLabourDataInquiry]", "[ChildCCtr] = '" &
strCCtr & "' And [ChildId] = 97")
--

Ken Snell
<MS ACCESS MVP>

faberk said:
Im not sure why this dlookup is not working. When i add the AND to my
conditions i return an error 13-type mismatch.

intFeb = DLookup("[FEB]", "[qryLabourDataInquiry]", "[ChildCCtr] = '" &
strCCtr & "'" And "[ChildId] = 97")

The variable strCCtr is a string and intFeb is decalred as a double. The
ChildId field in the query is an long integer. They work independently of
each othger, but return the 13 error msg when used together.

Thanks
 
A

Albert D. Kallal

try:

dim strWhere as string

strWhere = "[ChildCCtr] = '" & strCCtr & "' And [ChildId] = 97"

intFeb = DLookup("[FEB]", "[qryLabourDataInquiry]", strWhere)

It looks like you got a extra " here:

------->"[ChildId] = 97")
 

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

Using Max or DMax in DLookUp criteria? 1
Dlookup prob 3
populate textbox by name(number) 17
Dlookup() syntax 3
Dim problems 7
"<>" not working 4
DLookup Criteria 2
Data Type Mismatch with DLOOKUP 3

Top