Posted 7 August 2018, 6:15 am ESTHello,
We are using ComponentOne TDBGrid Pro 8.0 (OLEDB) Version 8.0.20081.362 in a VB6 app.
I am working on a new screen where we use several TDBDropDown controls to translate the codes of some fields. It is not the first time we use it, but now we are facing a new situation where we can not deal with.
Suppose the following main table LOCAIS that is in TDBGRID1:
These 2 last fields contain codes from the tables:
TABMECDET: (linked to field LD_MecDet through TDBDropDownMD)
TABTIPOSMECDET: (linked to field LD_TipoMecDet through TDBDropDownTD)
TD_CodMecDet (dependent on the value of MD_Codigo)
I can see the correct descriptions for the field LD_TipoMecDet when first feeding it, through this routine:
Private Sub TDBGrid1_BeforeColEdit(ByVal ColIndex As Integer, ByVal KeyAscii As Integer, Cancel As Integer)
If ColIndex = 13 Then
cmd3.CommandText = "SELECT * FROM TabTiposMecDet WHERE TD_CodMecDet='" + TDBGrid1.Columns("LD_MecDet").Value + "' ORDER BY TD_Descricao"
rsTD.Open cmd3, , adOpenStatic, adLockReadOnly
TDBDropDownTD.DataSource = rsTD
The problem is when we close and reopen the form, so the column LD_TipoMecDet is not showing the descriptions because it depends on the content of the field LD_MecDet. (see attached image)
I tried many routines in Form_Load, with no success.
Should I use a specific event to put this routine, or another one?
I am very grateful for any help.