|
-
December 21st, 1999, 02:28 AM
#1
view access database in visual basic
how to write the code of viewing microsoft access database in visual basic?
can u pls help me out of this problem?
i wanna use the visual basic to view the data from the access database
thanks alot
-
December 21st, 1999, 03:44 AM
#2
Re: view access database in visual basic
Goto Project-References. Add the Microsoft DAO 3.51 Object Library. And copy the follow code to your project.
Dim MyDB As Database, MySet As Recordset
' Open Database:
Set MyDB = OpenDatabase("d:\database.mdb")
'Create Recordset from query and load list with results:
Set MySet = MyDB.OpenRecordset("books") 'Open the Books table
MySet.MoveFirst
While MySet.EOF = False
Debug.Print MySet("name") 'Look the Name field
MySet.MoveNext
Wend
'Clean up - close objects:
MySet.Close
MyDB.Close
Set MySet = Nothing
Set MyDB = Nothing
[email protected]
http://vbcode.webhostme.com/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|