Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error 13 type mismatch

Status
Not open for further replies.

sirron

Programmer
Mar 11, 2004
139
US
I get this error evertime when i run this code. I have the database open already from other code.

Does anyone know why I'm getting this error. Are there components that need to be set up in VB or does this have to do something with my syntax or fields in the database?

Dim strID As String

strID = Trim(InputBox("Enter Name for search.", "Search Box"))

Set RS = DB.OpenRecordset("SELECT Sex " & "FROM AddressBook " & _
"WHERE [Name] Like '*" & strID & "*'")


 
Which data Access tools are you using (ADO or DAO)?
How are RS and DB declared and how is DB opened?


zemp
 

I'm using DAO 3.6 object library component

Delcare
Option Explicit
Option Compare Text
Dim DB As Database
Dim RS As Recordset


Database OPEN
Private Sub Form_Load()
Set DB = OpenDatabase(App.Path & "\vote.mdb")
End Sub
 
Nothing obvious in the info given that would cause the error.

Generally speaking the error is caused when one side of an expression is a numeric data type and the other is a value that can't be converted to a number.

eg Dim x As Long
x = "a"

 
To set off a wild shot:
Using reserved words as field names is always problematic:
[Name]

Try with renaming your field to Surname, Subject or similar. Then retry.

Cheers,
Andy

[blue]The last voice we will hear before the world explodes will be that of an expert saying:
"This is technically impossible!" - Sir Peter Ustinov[/blue]
 
Something else that can cause this is having both ADO and DAO references set in your app. If you do then a declaration like

Dim RS As Recordset

will be resolved by the first reference on your list that defines a recordset object. If that's ADO then you will get a type mismatch when you attempt to open what the system regards as an ADO recordset with DAO syntax. To be sure that you really are using DAO, try

Dim RS As DAO.Recordset
 
sorry, but i want to ask about voice to text conversion using VDICT, how to use it?
 
Hi eng.

1) Put up an extra thread for that, since it is a topic on its own. ;-)

2) What's vdict? a software?
If so: can a reference be set to it in VB?
Does it have object that can be addressed? Does it have a help file? ;-)

The more info you give in the new thread, the better the responses will be.

Cheers,
Andy

[blue]An eye for an eye only ends up making the whole world blind. - "Mahatma" Mohandas K. Gandhi[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top