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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Data Combo

Status
Not open for further replies.

teknik

Programmer
Feb 27, 2001
33
IN
I have a project in VB6 connecting to oracle 8.0 database. The form contains tab strip. The first tab strip contains many combo boxes displaying fields from various tables and the second tab contains Mhflexgrid displaying details froM a table. The data combos are filled with the respective values in the Form_Load using the following method :
dim rs as New ADODB.recordset
rs.open "select * from brand", connection, adopenstatic, adlockoptimistic
set datacombo.Rowsource = rs
datacombo.listfield = "NAME"
datacombo.Boundcolumn = "CODE"
When I double click on any row on the ,MHflexgrid, it should display the respective values in the combo boxes.
For this I open a record set and assign the value to the data combos as follows :
dim rs1 as New ADODB.recordset
rs1.open "select * from item", connection, adopenkeyset,
adlockoptimistic
datacombo.boundtext = rs1.Fields("code")
datacombo.refresh
The above code works perfectly but sometimes the data combo displays blank value. The value contained in rs1.Fields("code") is correct, but it does not assign that value to the data combo.
Please help
 
Hi Teknik,
I've recently had problems when using Form_Load and my solution was to place the code into the Form_Activate event instead, you may wish to try this. I encountered a similar problem to yours in Word VBA - I had code in Form_Initialize that occasionally did not work, my work around for that was to create a separate procedure with the initialization code in it then called this procedure before loading the form.

Hope this helps,
pmrankine

P.S. I'm newish to VB6 so I hope the above isn't bad practice or anything!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top