A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Recordset Object



 
 
Thread Tools Display Modes
  #1  
Old May 21st, 2004, 03:29 PM
Dominic
external usenet poster
 
Posts: n/a
Default 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  
Old May 21st, 2004, 03:44 PM
RobFMS
external usenet poster
 
Posts: n/a
Default 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  
Old May 21st, 2004, 04:23 PM
Dominic
external usenet poster
 
Posts: n/a
Default 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  
Old May 21st, 2004, 05:31 PM
hi
external usenet poster
 
Posts: n/a
Default Recordset Object

hi
  #5  
Old May 21st, 2004, 07:27 PM
Roxie Aho
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.