by Ts Bhusal (3 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 28th July 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code lists the data from a field in the combo Box
API Declarations
'Create a database with a Name "Database.mdb"
'make a field "Students" in the database. You can make others also
'in a form, draw a combo box and a command button
'draw a datacontrol in the form
with data1
.databasename=App.path & "\database.mdb" 'or C:\database.mdb; path
.recordsource="Select Students From Database" ' or "Students"
.refresh
end with
end sub
Private Sub Form_Load()
on error resume next
Do Until data1.recordset.EOF
combo1.additem data1.recordset.fields("Students")
data1.recordset.movenext
loop
End Sub