I have access database which I willuse form to retrieve a field to
show in List of combo box.
the method that I use now is adodb code when form load is show below.
Private Sub Form_Load()
Dim sql As String
Dim i As Integer
StrConn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & App.Path &
"\master.mdb;Pe rsist Security Info=False"
With Cn
If .State = adStateOpen Then .Close
.ConnectionStri ng = StrConn
.ConnectionTime out = 90
.CursorLocation = adUseClient
.Open
End With
sql = "SELECT * FROM Room"
Rs.Open sql, Cn, adOpenDynamic, adLockOptimisti c, adCmdText
' in this section, I will load the CustomerID to show in this form in
combo box.
cboCustomerID.C lear
For i = 1 To Rs.EOF
cboCustomerID.A ddItem !rs.("customeri d")
Next
' but it's still not work yet.
' the code below is not work anyway.. I'm still confuse the exactly
way to coding..
' With Rs
' Do Until .EOF
' cboCustomerID.A ddItem !roomid
' .MoveNext
' Loop
' End With
Call DisplayData 'this is an sub routine that will retrieve data from
field in database to show in textbox in my form. the most coding in
this section is txtroomid = rs("roomid")
.....
End Sub
please help me, I really want to show data in combo box
show in List of combo box.
the method that I use now is adodb code when form load is show below.
Private Sub Form_Load()
Dim sql As String
Dim i As Integer
StrConn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & App.Path &
"\master.mdb;Pe rsist Security Info=False"
With Cn
If .State = adStateOpen Then .Close
.ConnectionStri ng = StrConn
.ConnectionTime out = 90
.CursorLocation = adUseClient
.Open
End With
sql = "SELECT * FROM Room"
Rs.Open sql, Cn, adOpenDynamic, adLockOptimisti c, adCmdText
' in this section, I will load the CustomerID to show in this form in
combo box.
cboCustomerID.C lear
For i = 1 To Rs.EOF
cboCustomerID.A ddItem !rs.("customeri d")
Next
' but it's still not work yet.
' the code below is not work anyway.. I'm still confuse the exactly
way to coding..
' With Rs
' Do Until .EOF
' cboCustomerID.A ddItem !roomid
' .MoveNext
' Loop
' End With
Call DisplayData 'this is an sub routine that will retrieve data from
field in database to show in textbox in my form. the most coding in
this section is txtroomid = rs("roomid")
.....
End Sub
please help me, I really want to show data in combo box