dlookup prob

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
You have too many " characters:

intFeb = DLookup("[FEB]", "[qryLabourDataInquiry]", "[ChildCCtr] = '" &
strCCtr & "' And [ChildId] = 97")
 
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
 
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")
 
Back
Top