Run time error 13.Type mismatch. (1 Viewer)

pen

New member
Local time
Today, 20:44
Joined
Oct 3, 2001
Messages
6
I have added some vb coding to my access. below are it. In the refrence, I also have added

Microsoft DAO 3.6 Object Libarry,Microsoft ACtivex Data Objects 2.1 Library,Ole Automation, Visual Basic for Application, Microsoft Access 9.0 Object Library.

But at the """"" sign, I get the 'type mismatch ' error.

Dim db As Database
Dim wsp As Workspace
Dim rstemployee As Recordset

Set db = DBEngine.Workspaces(0).OpenDatabase("c:\programming\helpportal\helpportal.mdb")
Set wsp = DBEngine.Workspaces(0)

""""" Set rstemployee = db.OpenRecordset("employees", dbOpenDynaset)

rstemployee.Index = "primarykey"
rstemployee.Seek "=", cmbStaffID.Value
If rstemployee.EOF = True Then
MsgBox "Please Enter Valid Employee Id"
cmbStaffID.SetFocus
Else
txtName.Value = rstemployee.Fields("FName")
txtDesignation.Value = rstemployee.Fields("Title")
txtDepartment.Value = rstemployee.Fields("Dept")
End If

can anyone help....
thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:44
Joined
Feb 19, 2002
Messages
42,976
Try qualifying all the DAO objects -
DAO.Database
DAO.Workspace
DAO.Recordset
etc.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 15:44
Joined
Feb 28, 2001
Messages
27,001
Also adjust the priority of search in the references. Make the 3.6 DAO library first (if it wasn't already first.)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:44
Joined
Feb 19, 2002
Messages
42,976
If you qualify the DAO references, you should NOT change the priority of the ADO library. That will prevent you from using any ADO code in the database since the ADO objects will then be interpreted as DAO objects. Best to leave the ADO library first and qualify the DAO objects. Or ALWAYS qualify both the ADO and DAO objects.
 

Users who are viewing this thread

Top Bottom