Solved

Getting Datatype Mismatch in my DLookup

Posted on 2011-03-01
6
334 Views
Last Modified: 2012-05-11
I have the following DLookup and I keep a "Datatype Mismatch" error.

Me.Possible_Score = DLookup("[Possible Score]", "tblEnrollment_QualCriteriaReview", "[Subcode] = '" & Left([cboQualRevCriteria], 5) & "' And [Region] = '" & [Region] & "'")

What is wrong?

Thanks,

gdunn59
0
Comment
Question by:gdunn59
6 Comments
 
LVL 39

Expert Comment

by:als315
ID: 35010291
Try to change [Subcode] =
to
[Subcode] Like
0
 
LVL 7

Expert Comment

by:RemRemRem
ID: 35010335
That error usually means you're getting a mismatch between, say, a numeric value and a text value. For example, is the [Subcode] field numeric and the first 5 characters are supposed to be, but perhaps include something that has an "o" instead of a zero in it?

-Rachel
0
 
LVL 26

Expert Comment

by:Nick67
ID: 35011211
Your

 Left([cboQualRevCriteria], 5

is that string data or number data?

If it is a number then use CInt( Left([cboQualRevCriteria], 5)
if its alphanumeric try Chr(34) &  Left([cboQualRevCriteria], 5) & chr(34)

chr(34) is quotation marks "

I like Chr(34) & somestringvariable & chr(34) better than trying to get double sets of quotes to work.
Less frustration and easier to troubleshoot
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Accepted Solution

by:
gdunn59 earned 0 total points
ID: 35024092
I couldn't get it to work with any of the suggestions, so I just tried a different route.

Thanks everyone.

gdunn59
0
 
LVL 26

Expert Comment

by:Nick67
ID: 35085061
@gdunn59

It's ok if you went a different route, but post up what you did do.
That way everyone who may happen to google across your question finds an answer.

Nick67
0
 

Author Closing Comment

by:gdunn59
ID: 35120696
None of the other solutions worked, so I tried something else.  Thanks everyone for your assistance though!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now