Kiran Angara
2017-07-10T04:11:05Z
Hi,

I populate the grid with combo in few cells and load the combo with default data (including Active/Inactive rows) but when the user enter on the cell or click on the cell i want to load the combo with Active rows.

Could please let me know how i can acheive this.

Thank you.
Igor/10Tec
2017-07-10T10:48:23Z
Frankly speaking, it's not clear what you want to do. Can you publish some screenshots of your grid here to explain your problem better?
Kiran Angara
2017-07-11T01:48:51Z
Please refer to the picture for your kind perusal.

13

Click to View Image

Igor/10Tec
2017-07-11T12:33:50Z
It would be nice to see some accompanying code you use to populate the grid and the combo box. It is still hard to understand what is going on under the hood of the interface :)

If we understand you right, you populate the combo box in the Equipment column using the FillFromRS method of the corresponding ComboObject. If you want to repopulate this combo box only with Active rows, you can do the following:

1) Clear the combo box with the ComboObject.Clear method.

2) Execute a query to the table that returns only rows with the status 'Active' in an ADO or DAO Recordset object.

3) Feed this recordset to the FillFromRS method again.
Kiran Angara
2017-07-12T06:58:27Z
Hi,

Good afternoon.
Thank you for your valuable suggestion.
Please refer to the below code for your kind perusal and do the need full.

/* Step 1: Fill grid combo with Active/Inactive rows.

sSQL = "SELECT InspectionCharacteristicID, Name FROM Setup.InspectionCharacteristic ORDER BY Name"
Set rsFillCombo = New ADODB.Recordset
If rsFillCombo.State = 1 Then rsFillCombo.Close
rsFillCombo.Open sSQL, m_ConnectDB, adOpenForwardOnly, adLockReadOnly

With iGridName(iGrd)
.BeginUpdate
Set cboGrid = .Combos.Add("InspectionCharacteristicID")
cboGrid.FillFromRS rsFillCombo, "Name", "InspectionCharacteristicID"
cboGrid.AutoAdjustWidth
.EndUpdate
End With
Set rsFillCombo = Nothing
*/

/* Step 2: Populate grid rows

strSQL = "SELECT StockInspectionID, InspectionCharacteristicID, EquipmentTypeID, DefectCategoryID, SamplingSizeID, SamplingTypeID, InspectionLevelID,MinSpecification,MaxSpecification,IsOnlineMonitor
FROM RD.StockItemInspection WHERE (StockitemID = 1)"
Set rsFill = New ADODB.Recordset
rsFill.Open strSQL, m_ConnectDB

With iGrid
.BeginUpdate
.FillFromRS rsFill, , "StockInspectionID"
.AddRow
.EndUpdate
End With
*/

/* Step 3: Refill combo with only Active rows

sSQL = "SELECT InspectionCharacteristicID, Name FROM Setup.InspectionCharacteristic WHERE (Active = 1) ORDER BY Name"
Set rsFillCombo = New ADODB.Recordset
If rsFillCombo.State = 1 Then rsFillCombo.Close
rsFillCombo.Open sSQL, m_ConnectDB, adOpenForwardOnly, adLockReadOnly

With iGridName(iGrd)
.BeginUpdate
Set cboGrid = .Combos.Add("InspectionCharacteristicID")
cboGrid.FillFromRS rsFillCombo, "Name", "InspectionCharacteristicID"
cboGrid.AutoAdjustWidth
.EndUpdate
End With
Set rsFillCombo = Nothing

14

Click to View Image

Igor/10Tec
2017-07-12T15:35:16Z
If you want to use only active rows in the combo, I see no need in Step 1. Replace it with Step 3, and populate the grid using Step 2 then.

Publish also your initialization code for iGrid - I'd like to see how you define your columns and attach the combo.
Kiran Angara
2017-07-13T03:09:22Z
Hi,

Good morning.
I attached a sample project file for your kind perusal.
Please go through it and give your valuable suggestions.

  iGridCellCombo.zip (31kb) downloaded 183 time(s).
Igor/10Tec
2017-07-13T12:30:25Z
When I open the project, I get a error message that the referenced MSRDC20.OCX can't be found. Even if I ignore this, I can't launch your project - get many compilation errors, like Sub LoadRDefaults not found...

Make the product useable on another pc and reupload it again on this forum. Tell us also how to reproduce your problem in a detailed step-by-step instruction.
Kiran Angara
2017-07-14T03:11:46Z
Hi,

Apologies for uploading wrong compilation.

1. Open the project you can see the grid will be load with 2 rows.
2. The Characteristic column values (Appearance, Year Stamp) are visible along with other column.
3. Close the project.
3. Open the iGrid.mdb database and change the Active column value to False in database table (Inspection Characteristic) to
either one of the characteristics displayed in the grid.
4. Reopen the project and notice the characteristic column value is missing.

Thank you.

  iGridCombo 1.0.zip (29kb) downloaded 182 time(s).
Igor/10Tec
2017-07-14T14:37:05Z
Excellent! Thank you for project - now it's easy to explain the effect you see looking at the real source code.

See, the combo box in the Characteristic column is populated using only active values from the InspectionCharacteristic table. Every item in the combo box consists of two parts - the visible text (the Name field) and the invisible value (the InspectionCharacteristicID field). When you populate the grid, only numeric IDs are placed in the Characteristic column of the grid as you populate it from the InspectionCharacteristicID field from the StockItemInspection table. But on the screen you see the text of the corresponding characteristic as it is dynamically retrieved from the combo box using the ID as a key. iGrid uses this ID (i.e. the cell value) to find the corresponding combo box item by its invisible value.

If you set the Active field for a record in the InspectionCharacteristic table to False, this record is not loaded into the combo box as it is not included into the recordset returned when you execute the corresponding query. The iGrid cell still contains this ID (it comes from the main table), but iGrid can't find the corresponding combo box item by this value and the cell text becomes empty. Note that the cell value is an ID, but we are talking about the cell text linked dynamically to the cell value in the case when the cell type is combo.
Kiran Angara
2017-07-14T16:04:09Z
Hi,

Thank you for your valuable feedback.

You mean to say i need to use celltext property right.

Could you please provide syntax or sample to implement your suggestion.

Thank you.
Igor/10Tec
2017-07-17T15:47:29Z
I've never mentioned "CellText" anywhere. Frankly speaking, I do not understand the logic of your app and what you want to do. Do you really need to use combo box cells in the column we are discussing?
Kiran Angara
2017-07-17T23:22:17Z
Yes, i need to use combo in the columns.

I want to known how to display the grid column cell values (Characteristic column) even though the combo box was populated using only active values from the InspectionCharacteristic table.

I can't display the grid combo cell values without first fill the combos with recordset values otherwise app crashes.

I tried this way 1. Fill the combo with recordset active/inactive values 2. Populate the grid cell values using FillFromRS 3. Refill the combo with active values. But the problem is after refill the combo with active values the existing cell values in the grid are changed.
Igor/10Tec
2017-07-18T15:56:40Z
Kiran, you contradict yourself. You can't display characteristic texts in the Characteristic column linked to the combo box if there is no corresponding item in the combo box. The cell value is a numeric ID, and iGrid can't find the corresponding combo item text if the combo does not contain an item with this numeric value.
Kiran Angara
2017-08-14T08:29:49Z
Originally Posted by: Igor/10Tec 

Kiran, you contradict yourself. You can't display characteristic texts in the Characteristic column linked to the combo box if there is no corresponding item in the combo box. The cell value is a numeric ID, and iGrid can't find the corresponding combo item text if the combo does not contain an item with this numeric value.



Yes, you are correct.
I did it in this way as explained. nUser can view all the items in the cell combo but can select only the active items others can't because the itemvalue = 0 for inactive items.

so please consider this post as completed.

Thank you.