This is a simple code to display column contents from access database and display it on the listbox
This is a simple code to display column contents from access database and display it on the listbox. Then from there U can click on the
API Declarations
' 1. List box
' 2. command button
' 3. text box
Rate This is a simple code to display column contents from access database and display it on the listbox
(1(1 Vote))
Dim OldDb As Database, NewSnap As Recordset, OldWs As Workspace
Dim rcset As Recordset
Set OldWs = DBEngine.Workspaces(0)
' assume your database is located at C:\inventory1\db2.MDB
Set OldDb = OldWs.OpenDatabase("C:\inventory1\db2.MDB")
' assume the record that u going to work with is Customers
Set rcset = OldDb.OpenRecordset("Customers", dbOpenTable)
' this will get custid field from customers table and load it to the
' listbox
Set rcset = OldDb.OpenRecordset("select Custid from Customers ")
rcset.OpenRecordset
While Not rcset.EOF
Dim i As Integer
For i = 0 To rcset.RecordCount
i = rcset("Custid")
List1.AddItem i
rcset.MoveNext
Next i
Wend
MsgBox rcset.RecordCount
End Sub
Private Sub List1_Click()
Dim a
a = List1.ListIndex
text1 = List1.List(X)
End Sub
This is a simple code to display column contents from access database and display it on the listbox Comments
No comments yet — be the first to post one!
Post a Comment