Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Combobox

Status
Not open for further replies.

bbrendan

IS-IT--Management
Dec 13, 2001
109
GB
Hi im just in need of some help on how to populate a combobox "dropdown list" type.

I know I can easily do it using a standard combo, but I wanted to use a dropdown list as it stops the end user from editing the entry to something other than the list in the combo.

When ever I try and load the form, the program dies with the following error.

Run-Time Error '383'
'Text' property is read-only

I can work out how to get around this!.

Any Ideas????????
here's the code:
----------------------------------------------------------------
Dim oRSMain As ADODB.Recordset
Dim strConnect As String
Dim strSQL As String
Dim strSQLDet As String

strConnect = INI_getString("String", "ConnectString1", App.Path & "\dataconn.ini")

strSQL = "Select * from Orders where OrderID = " & frmOrders.DGridOrdList.Columns(0).Value

Set oRSMain = New Recordset

oRSMain.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly

With oRSMain
frmOrders.cboBillCountry.Text = oRSMain.Fields("BillCountry").Value & ""
end with

---------------------------------------------------------------------
 
Use the AddItem method. For details see VBHelp

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Set the combo box's .style property to '2 - Dropdown List'.

zemp
 
oRSMain.movefirst

Do until oRSMain.EOF
MYcomboBox.AddItem oRSMain![BillCountry]
oRSMain.movenext
Loop

Try this... I hope oRSMain is your record set and Bill... is the field you want to populate the combo with.

Let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top