SQL & type mismatch? 
Author Message
 SQL & type mismatch?

Hi there ;--)

I am using DAO in my project and an Access database.

What I am trying to do is:
I am reading the primary key of a record in a variable.

iPrimaryKey = CInt(frmList.FlxList.Text)

Then I create a recordset with my dbs database variable with only this
record.

strquery = "SELECT * FROM tbAdressen WHERE [AdresId] = ' " & iPrimaryKey &
" ' "

set rstAdressen = dbs.openrecordset(strQuery,dbOpenDynaset)

The problem is that I continuously get an error saying :

'data type mismatch in criteria expression' (error number 3464)

Whatever I do, I can't get it going. Any suggestions what I did wrong in
the select statement.

Thanks !!



Sun, 22 Apr 2001 03:00:00 GMT  
 SQL & type mismatch?
Loose the single quotes (they are only for strings)
 quotes

strquery = "SELECT * FROM tbAdressen WHERE [AdresId] = " & iPrimaryKey

Quote:

>Hi there ;--)

>I am using DAO in my project and an Access database.

>What I am trying to do is:
>I am reading the primary key of a record in a variable.

>iPrimaryKey = CInt(frmList.FlxList.Text)

>Then I create a recordset with my dbs database variable with only this
>record.

>strquery = "SELECT * FROM tbAdressen WHERE [AdresId] = ' " & iPrimaryKey &
>" ' "

>set rstAdressen = dbs.openrecordset(strQuery,dbOpenDynaset)

>The problem is that I continuously get an error saying :

>'data type mismatch in criteria expression' (error number 3464)

>Whatever I do, I can't get it going. Any suggestions what I did wrong in
>the select statement.

>Thanks !!



Sun, 22 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL & Type Mismatch

2. Prob. w\ TYPE data type: err:Type Mismatch

3. Type Mismatch with Format Function & Preceding Zeros

4. Type mismatch in sub & function calls

5. Val function & Type mismatch

6. Calculations, type mismatch & MSDN Calc Sample error

7. Type Mismatch Error CR8.5 Developer & VB6

8. Data Type Mismatch & Automation Error -2147217913

9. LINEST & a Type Mismatch

10. Data Type mismatch error in a SQL statement

11. Data type mismatch in SQL criteria expression - Access 97

12. Type Mismatch when SQL'ing Recordsource

 

 
Powered by phpBB® Forum Software