PC Review


Reply
Thread Tools Rate Thread

Dlookup error on check box

 
 
=?Utf-8?B?cG9rZGJ6?=
Guest
Posts: n/a
 
      16th Feb 2006
I have this statement:
Check = DLookup("noContact", "TableInterviewStatus", "interviewId = '" &
Me.TextStatusId & "' And visit = " & Me.TextStatusVisit)

noContact is a check box field it is giving me an error on this statment
"Data type mismatch"

I have tried Check as a bunch of different data types, integer, boolean,
variant and text.

Any idea what the problem is?
 
Reply With Quote
 
 
 
 
tina
Guest
Posts: n/a
 
      16th Feb 2006
a DLookup() on a boolean field returns an Number value, either 0 or -1. you
should be able to assign this value to a variable with a data type of
Boolean, Integer, String, or Variant. perhaps the problem is in the
DLookup() function itself. in your code, try running the following code, as

Debug.Print DLookup("noContact", "TableInterviewStatus", _
"interviewId = '" & Me.TextStatusId & "' And visit = " _
& Me.TextStatusVisit)

open the Immediate window (Ctrl+g) to see the return value. if the function
generates the same error message, double check the TableInterviewStatus to
make sure that the interviewId field is Text data type, and the visit field
is a Number data type.

hth


"pokdbz" <(E-Mail Removed)> wrote in message
news:CD0878DA-5F45-4B04-A556-(E-Mail Removed)...
> I have this statement:
> Check = DLookup("noContact", "TableInterviewStatus", "interviewId = '" &
> Me.TextStatusId & "' And visit = " & Me.TextStatusVisit)
>
> noContact is a check box field it is giving me an error on this statment
> "Data type mismatch"
>
> I have tried Check as a bunch of different data types, integer, boolean,
> variant and text.
>
> Any idea what the problem is?



 
Reply With Quote
 
fredg
Guest
Posts: n/a
 
      16th Feb 2006
On Thu, 16 Feb 2006 13:07:31 -0800, pokdbz wrote:

> I have this statement:
> Check = DLookup("noContact", "TableInterviewStatus", "interviewId = '" &
> Me.TextStatusId & "' And visit = " & Me.TextStatusVisit)
>
> noContact is a check box field it is giving me an error on this statment
> "Data type mismatch"
>
> I have tried Check as a bunch of different data types, integer, boolean,
> variant and text.
>
> Any idea what the problem is?


My guess its your where clause.
What is the datatype of [interviewId]?
It sound like it might be Number. Assuming [Visit] is also a Number
datatype try:

....., "interviewId = " & Me.TextStatusId & " And visit = " &
Me.TextStatusVisit)

However if [Visit] is Text then:

"interviewId = " & Me.TextStatusId & " And visit = '" &
Me.TextStatusVisit & "'")

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
=?Utf-8?B?cG9rZGJ6?=
Guest
Posts: n/a
 
      17th Feb 2006
thanks for the help the problem was interviewId was a number not text. Thanks.

"fredg" wrote:

> On Thu, 16 Feb 2006 13:07:31 -0800, pokdbz wrote:
>
> > I have this statement:
> > Check = DLookup("noContact", "TableInterviewStatus", "interviewId = '" &
> > Me.TextStatusId & "' And visit = " & Me.TextStatusVisit)
> >
> > noContact is a check box field it is giving me an error on this statment
> > "Data type mismatch"
> >
> > I have tried Check as a bunch of different data types, integer, boolean,
> > variant and text.
> >
> > Any idea what the problem is?

>
> My guess its your where clause.
> What is the datatype of [interviewId]?
> It sound like it might be Number. Assuming [Visit] is also a Number
> datatype try:
>
> ....., "interviewId = " & Me.TextStatusId & " And visit = " &
> Me.TextStatusVisit)
>
> However if [Visit] is Text then:
>
> "interviewId = " & Me.TextStatusId & " And visit = '" &
> Me.TextStatusVisit & "'")
>
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DLookup error Charlie O'Neill Microsoft Access 1 17th Jan 2010 09:51 PM
dlookup function only check first record in a table =?Utf-8?B?RGF2ZSBT?= Microsoft Access Forms 2 6th Mar 2007 07:24 PM
Re: Dlookup function - copying the dlookup info into a field.... Douglas J. Steele Microsoft Access Forms 0 6th Dec 2006 02:05 PM
Check value by DLookup Eric Microsoft Access 1 24th Aug 2006 01:35 PM
How to get DLookup working correctly to check if a record already exists in the database Pressedrat N Warthog Microsoft Access VBA Modules 2 19th Dec 2004 04:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:42 PM.