I have a set of DataCombo boxes that I'm using to provide a set list of options for the user to select from. The selections are saved, along with other data, in another database table to be retrieved later. I'm using a DataCombo to bind to the table and display the list instead of just loading the list into a regular combo because the list is over 12,000 items long, causing an unacceptable delay in form loading. Using the DataCombo allows the form to load instantaneously.
I create a recordset upon starting the program that open the table containing my list of items, gcsICD. In the Form_Load event of the form in question, I have the following code:
Set dcActive.RowSource = grsList
dcActive.ListField = "Code_Des"
Set dcActive.DataSource = grsList
dcActive.DataField = "CodeID"
When I save my data:
!Code = dcActive.SelectedItem
From looking further I think it's just giving me .AbsolutePosition, not the actual ID field I intended, but it doesn't matter because the ID field is just a counter so the values are the same.
My problem arises on reloading my data for display. I need to be able to set the DataCombo selection on a specific item, based on the ID I pull back up from my database. If I need to reference it as AbsolutePosition of something, I can, because they come to the same thing.
I have tried setting the .AbsolutePosition of my underlying recordset (grsList.AbsolutePosition = !Code), but that doesn't work. I'm not sure how well that would work anyway, because I've got 10 of these DataCombos. If it were a straight ListBox or ComboBox, I could set the .ListIndex and be done with it. I need this DataCombo to allow my forms to load rapidly. How can I reset the DataCombo selection at runtime?
Solinox
I create a recordset upon starting the program that open the table containing my list of items, gcsICD. In the Form_Load event of the form in question, I have the following code:
Set dcActive.RowSource = grsList
dcActive.ListField = "Code_Des"
Set dcActive.DataSource = grsList
dcActive.DataField = "CodeID"
When I save my data:
!Code = dcActive.SelectedItem
From looking further I think it's just giving me .AbsolutePosition, not the actual ID field I intended, but it doesn't matter because the ID field is just a counter so the values are the same.
My problem arises on reloading my data for display. I need to be able to set the DataCombo selection on a specific item, based on the ID I pull back up from my database. If I need to reference it as AbsolutePosition of something, I can, because they come to the same thing.
I have tried setting the .AbsolutePosition of my underlying recordset (grsList.AbsolutePosition = !Code), but that doesn't work. I'm not sure how well that would work anyway, because I've got 10 of these DataCombos. If it were a straight ListBox or ComboBox, I could set the .ListIndex and be done with it. I need this DataCombo to allow my forms to load rapidly. How can I reset the DataCombo selection at runtime?
Solinox