Run-Time error 13: Type Mismatch?

ReaperFett
04-13-2004, 04:15 AM
Okay, I have started a page where I need to access my MS Access Database. The page starts:

Dim MyDataBase As Database
Dim rs As Recordset

Private Sub Form_Load()
Set MyDataBase = OpenDatabase(App.Path & "\Library.mdb")
Set rs = MyDataBase.OpenRecordset("Password")
End Sub


In the same directory as this VB is saved I have Library.mdb. Inside is a table called Password, which has a single field inside called PW, which is made to be the Primary Key.

When I try to run this, I get the error message

Run-time erroer '13':

Type mismatch

When I press debug, it highlights "Set rs = MyDataBase.OpenRecordset("Password")".


Does anyone know what is going wrong?

Shurik12
04-13-2004, 04:51 AM
Dim MyDataBase As DAO.Database
Dim rs As DAO.Recordset

Private Sub Form_Load()
Set MyDataBase = OpenDatabase(App.Path & "\Library.mdb")
Set rs = MyDataBase.OpenRecordset("[Password]")
End Sub


Shurik.

ReaperFett
04-13-2004, 05:00 AM
Thanks :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum