If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Recordset Object
Hello,
I'm using Access 2002, and trying to create a recordset object. I've Included the "Microsoft DAO" library in my references. I currently have a form, table and a module setup in my database. I have used the Onload function of the form to call a function named Setup() which has been coded in a module. I keep on receiving the following error "Run-Time Error 13 - Type Mismatch", when trying to Set the recordset. This is what my module looks like: Option Compare Database Public db As Database Private rst As Recordset Option Explicit Function Setup() Set db = DBEngine.Workspaces(0).Databases(0) - Set rst = db.OpenRecordset("tblEmployee") End Function Any help would be appreaciated, thanks. Dominic |
#2
|
|||
|
|||
Recordset Object
Change:
Public db As Database Private rst As Recordset Set db = DBEngine.Workspaces(0).Databases(0) To: Public db As DAO.Database Public rst As DAO.Recordset Set db = CurrentDB() See if this resolves the error. -- Rob FMS Professional Solutions Group http://www.fmsinc.com/consulting Software Tools for .NET, SQL Server, Visual Basic & Access http://www.fmsinc.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- "Dominic" wrote in message ... Hello, I'm using Access 2002, and trying to create a recordset object. I've Included the "Microsoft DAO" library in my references. I currently have a form, table and a module setup in my database. I have used the Onload function of the form to call a function named Setup() which has been coded in a module. I keep on receiving the following error "Run-Time Error 13 - Type Mismatch", when trying to Set the recordset. This is what my module looks like: Option Compare Database Public db As Database Private rst As Recordset Option Explicit Function Setup() Set db = DBEngine.Workspaces(0).Databases(0) - Set rst = db.OpenRecordset("tblEmployee") End Function Any help would be appreaciated, thanks. Dominic |
#3
|
|||
|
|||
Recordset Object
Can't understand why ? but your way works.
Thanks Rob ! -----Original Message----- Change: Public db As Database Private rst As Recordset Set db = DBEngine.Workspaces(0).Databases(0) To: Public db As DAO.Database Public rst As DAO.Recordset Set db = CurrentDB() See if this resolves the error. -- Rob FMS Professional Solutions Group http://www.fmsinc.com/consulting Software Tools for .NET, SQL Server, Visual Basic & Access http://www.fmsinc.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- "Dominic" wrote in message ... Hello, I'm using Access 2002, and trying to create a recordset object. I've Included the "Microsoft DAO" library in my references. I currently have a form, table and a module setup in my database. I have used the Onload function of the form to call a function named Setup() which has been coded in a module. I keep on receiving the following error "Run- Time Error 13 - Type Mismatch", when trying to Set the recordset. This is what my module looks like: Option Compare Database Public db As Database Private rst As Recordset Option Explicit Function Setup() Set db = DBEngine.Workspaces(0).Databases(0) - Set rst = db.OpenRecordset("tblEmployee") End Function Any help would be appreaciated, thanks. Dominic . |
#4
|
|||
|
|||
Recordset Object
hi
|
#5
|
|||
|
|||
Recordset Object
Starting with Access 2000, Microsoft added ADO (ActiveX
data objects). What Rob did was specify that Access is to use the DAO (Data Access Object) library. Roxie Aho -----Original Message----- Can't understand why ? but your way works. Thanks Rob ! -----Original Message----- Change: Public db As Database Private rst As Recordset Set db = DBEngine.Workspaces(0).Databases(0) To: Public db As DAO.Database Public rst As DAO.Recordset Set db = CurrentDB() See if this resolves the error. -- Rob FMS Professional Solutions Group http://www.fmsinc.com/consulting Software Tools for .NET, SQL Server, Visual Basic & Access http://www.fmsinc.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- "Dominic" wrote in message .. . Hello, I'm using Access 2002, and trying to create a recordset object. I've Included the "Microsoft DAO" library in my references. I currently have a form, table and a module setup in my database. I have used the Onload function of the form to call a function named Setup() which has been coded in a module. I keep on receiving the following error "Run- Time Error 13 - Type Mismatch", when trying to Set the recordset. This is what my module looks like: Option Compare Database Public db As Database Private rst As Recordset Option Explicit Function Setup() Set db = DBEngine.Workspaces(0).Databases(0) - Set rst = db.OpenRecordset("tblEmployee") End Function Any help would be appreaciated, thanks. Dominic . . |
Thread Tools | |
Display Modes | |
|
|