Data Type Mismatch & Automation Error -2147217913

Data Type Mismatch & Automation Error -2147217913

Post by Michael Lockhar » Mon, 28 Apr 2003 05:33:00



Problem: Trying to search an Access 2000 database table.
The field is a Number data type(long integer and tried
just integer).

I'm using VB 6 and ADO

I use a string variable and passed it to both ways Long
and Integer types. ex: intBedId = CInt(strBedId)

I'm using a bound ADO control
This statement works when I directly input a value, value
is 2. This statement runs correctly without a hitch:
adoInToBed.RecordSource = _
  "SELECT * FROM InmateToLock WHERE InmateToLock.BedID = 2"

However, if I try using a variable (intBedId) and after
refreshing I receive an error: "Data Type mismatch in
criteria expression"

This is the SELECT Statement:
adoInToBed.RecordSource = _
  "SELECT * FROM InmateToLock WHERE InmateToLock.BedID = "
& "'" & intBedid & "'"
adoInToBed.Refresh

I've error trapped it and here are the numbers:
Error Number: -2147217913
Source: IMS
Error Description: Automation Error
Error Help Context: 1000440

I've tried every variable type known to me to avoid a type
mismatch but no luck and there is no documentation on this
problem, nothing is working. Can anyone help?

Thank you,
Michael Lockhart

 
 
 

Data Type Mismatch & Automation Error -2147217913

Post by Douglas J. Steel » Mon, 28 Apr 2003 06:11:30


Since BedID is obviously a numeric field (or the SQL wouldn't work when you
put 2 in), remove the single quotes from your expression:

"SELECT * FROM InmateToLock WHERE InmateToLock.BedID = " & intBedid

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele


Quote:> Problem: Trying to search an Access 2000 database table.
> The field is a Number data type(long integer and tried
> just integer).

> I'm using VB 6 and ADO

> I use a string variable and passed it to both ways Long
> and Integer types. ex: intBedId = CInt(strBedId)

> I'm using a bound ADO control
> This statement works when I directly input a value, value
> is 2. This statement runs correctly without a hitch:
> adoInToBed.RecordSource = _
>   "SELECT * FROM InmateToLock WHERE InmateToLock.BedID = 2"

> However, if I try using a variable (intBedId) and after
> refreshing I receive an error: "Data Type mismatch in
> criteria expression"

> This is the SELECT Statement:
> adoInToBed.RecordSource = _
>   "SELECT * FROM InmateToLock WHERE InmateToLock.BedID = "
> & "'" & intBedid & "'"
> adoInToBed.Refresh

> I've error trapped it and here are the numbers:
> Error Number: -2147217913
> Source: IMS
> Error Description: Automation Error
> Error Help Context: 1000440

> I've tried every variable type known to me to avoid a type
> mismatch but no luck and there is no documentation on this
> problem, nothing is working. Can anyone help?

> Thank you,
> Michael Lockhart


 
 
 

Data Type Mismatch & Automation Error -2147217913

Post by RushYe » Tue, 29 Apr 2003 10:31:39


Doug,

I want to thank you very much. I was so caught up in passing values
through string variables that I over looked a very simple process. This
process had me caught up for well over 8 hours! Most of the time it's
the simplest things that are over looked and this time is definately the
case!

Thank you again and again for taking the time to help me!
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

Data Type Mismatch & Automation Error -2147217913

Post by shiv » Wed, 30 Apr 2003 18:53:42


hi micheal

do not use data bound controls , you will some where in end up with great
disaster
use a class and let gui use the class for flourishing.Data bound control
dictate how you code , here you dictate how the code works.

--
Shivprasad Koirala

Griffin Marine IT Department
syngrou 5 athens
After all, on a twenty-four hour basis....
Marine Travel is our business
visit our website:  www.griffintravel.com

mobile (030) - 944 392 362


Quote:> Doug,

> I want to thank you very much. I was so caught up in passing values
> through string variables that I over looked a very simple process. This
> process had me caught up for well over 8 hours! Most of the time it's
> the simplest things that are over looked and this time is definately the
> case!

> Thank you again and again for taking the time to help me!
> Michael

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

 
 
 

Data Type Mismatch & Automation Error -2147217913

Post by Michael Lockhar » Thu, 01 May 2003 10:54:07


Shiv,
Thank you for the tip. I'm a fairly new programmer with little
experience. I'm currently trying to create a working model for proposal
purpose. I work full time, and go to school full time and can only work
on my project an hour here and a hour there. Thus the bound controls
over unbound.

I will definetly look into this technique because I like to organize and
optimize my code. Also, I like to learn! Thank you for your time and I
appreciate any and all advice!

Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

1. Data Type Mismatch & Automation Error -2147217913

Problem: Trying to search an Access 2000 database table.
The field is a Number data type(long integer and tried
just integer).

I'm using ADO 6.0

I use a string variable and passed it to both ways Long
and Integer types. ex: intBedId = CInt(strBedId)

I'm using a bound ADO control
This statement works when I directly input a value, value
is 2. This statement runs correctly without a hitch:
adoInToBed.RecordSource = _
  "SELECT * FROM InmateToLock WHERE InmateToLock.BedID = 2"

However, if I try using a variable (intBedId) and after
refreshing I receive an error: "Data Type mismatch in
criteria expression"

This is the SELECT Statement:
adoInToBed.RecordSource = _
  "SELECT * FROM InmateToLock WHERE InmateToLock.BedID = "
& "'" & intBedid & "'"
adoInToBed.Refresh

I've error trapped it and here are the numbers:
Error Number: -2147217913
Source: IMS
Error Description: Automation Error
Error Help Context: 1000440

I've tried every variable type known to me to avoid a type
mismatch but no luck and there is no documentation on this
problem, nothing is working. Can anyone help?

Thank you,
Michael Lockhart

2. Querry The windows NT User Account

3. type mismatch error while importing data to a BIT type column

4. sp timing out

5. Error 2147217913

6. sql question

7. Type Mismatch while using Activex Script Task with numeric data type

8. FPM and Imagewriter

9. Data Types in CreateParameter statement causing type mismatch

10. VB 4.0 Data Control Recordset property generates a Type Mismatch error with DAO 3.5

11. Type mismatch error when assigning a recordset to a data control (VB5)

12. Data Type Mismatch in SQL error....

13. Access 2.0 / VB5 Type mismatch error in the data control