Still trying to connect

andm

New member
Local time
Today, 20:27
Joined
Feb 1, 2001
Messages
6
Hi there!

I wrote earlier. Your reply sounded great, but when I tried it, it said:
"User defined type not defined"

Do I need to declare something first?

This was the code in your suggestion:


Option Compare Database

Public dbs As database
Public rst As Recordset
Public Sql_Str As String


Public Function Test()

'Set dbs = CurrentDb
'Set rst = dbs.OpenRecordset("TableName")

'This is a very simple way to open a table. You can get specific by using a SQL String.

Set dbs = CurrentDb
Sql_Str = "Select * from t_Corp Actions"
Set rst = dbs.OpenRecordset(Sql_Str)

End Function

Thanks again, for your help! Andrea
 
make sure you have the DAO 3.6 library referenced in your database. Go to th menu item Tools>>References after you have opened any module.

if the DAO library is not referened scroll down to find it and chack the box next to it.

also you will want to append DAO to your variable declarations if you have the ADO library referenced also. This will be to remove any conflicts.

Do it like this

Public dbs as DAO.Database
Public rst as DAO.Recordset

if you don't intend to use ADO functionality in your database you can just remove the reference to the ADO library.

ntp
 

Users who are viewing this thread

Back
Top Bottom