Load data from access to combo box in vb
Solved/Closed
Related:
- Load data from access to combo box in vb
- Ms access download - Download - Databases
- How to access google usa - Guide
- Transfer data from one excel worksheet to another automatically - Guide
- Tmobile data check - Guide
- Access and downloading - Facebook Forum
3 responses
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String
Dim I As Integer
con.Open "Provider=sqloledb;Data Source=SSST41;Initial Catalog=sample;User ID=sa;Password=;"
str = "select name from stutable"
rs.Open str, con
i = 0
While Not rs.EOF
Combo1.List(i) = rs.Fields(0)
rs.MoveNext
i = I + 1
Wend
rs.Close
Dim rs As New ADODB.Recordset
Dim str As String
Dim I As Integer
con.Open "Provider=sqloledb;Data Source=SSST41;Initial Catalog=sample;User ID=sa;Password=;"
str = "select name from stutable"
rs.Open str, con
i = 0
While Not rs.EOF
Combo1.List(i) = rs.Fields(0)
rs.MoveNext
i = I + 1
Wend
rs.Close
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 20, 2010 at 09:55 AM
Aug 20, 2010 at 09:55 AM
Where is this combobox ? is it on access form or some thing else
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 20, 2010 at 10:47 AM
Aug 20, 2010 at 10:47 AM
It has been some time since I have played with VB. But from what I recall, you could set it record source to a sql statement.
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim I As Integer
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Asm-isntc-asus\database\mast.mdb;Persist Security Info=False"
str = "select Name from mast"
rs.Open str, con
i = 0
While Not rs.EOF
Combo3.List(i) = rs.Fields(0)
rs.MoveNext
i = I + 1
Wend
rs.Close
Dim rs As New ADODB.Recordset
Dim I As Integer
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Asm-isntc-asus\database\mast.mdb;Persist Security Info=False"
str = "select Name from mast"
rs.Open str, con
i = 0
While Not rs.EOF
Combo3.List(i) = rs.Fields(0)
rs.MoveNext
i = I + 1
Wend
rs.Close
Dec 14, 2010 at 02:42 AM