Forum: base
Page 14753
Subject: WAY OT - VB code - How to access database


  Posted by: Monster - [33482621] Thu, May 01, 2003, 22:30

Hi, this is really off topic. If you guys want me to delete it, I will.

I'm pretty new to VB. I just learned to create a database file from Access.

now i want to be able to access the database for info in the program.

so far, I've found two supposed way of doing this.

First one was really complicated and I didnt understand it.

Second way was from this book called VB Bible. It basically says use this

Dim DB as Database
Set DB = OpenDatabase("filelocation")

then to access the stuff

Dim rs as recordset
set rs = db.openrecordset("name", dbopenDynast")

when I try this. first error msg i get is that Database is not proper user-defined type.
then it doesnt recognize the function OpenDatabase, not to mention the openrecordset.

Could someone give me some help? Thanks
 
1SillySpheres at Work
      ID: 582492810
      Thu, May 01, 2003, 22:41
Did you set up the database as an ODBC source? If I recall correctly, you need to have the database "registered" with windows via the ODBC interface in order to access it via VB.