Click to See Complete Forum and Search --> : HELP PLS


keith22
December 20th, 1999, 07:57 AM
how to convert the access database to show in the visual basic? (i mean the code)
somebody pls help, i am a beginner here. thanks alot

Weasel
February 9th, 2000, 08:03 AM
Dim DB As Database
Dim RS As Recordset
Dim theData(100) As String ' when full, empty and continue
Dim counter As Long

Dim x As Long

Dim DB As Database
Dim RS As Recordset
Set DB = Nothing
Set DB = OpenDatabase("C:\accessdb.mdb", False, False, ";pwd=123456")
'opens database C:\ACCESSDB.MDB with password 123456
Set RS = DB.OpenRecordset("SELECT * FROM TheTable")
RS.MoveFirst
counter = 0
While Not RS.EOF
counter = counter + 1
theData(counter) = RS!Name
RS.MoveNext
Wend
RS.Close
DB.Close

For x = 1 To counter
MsgBox theData(x)
Next x

'This should display all "Name" in "TheTable"
'(But it only handles 100 before running out of
'room in the array)