Hello all,
I am trying to write a piece of code to take a strSQL statement (created in code on the fly and saved in a global variable -- i.e., not a saved query) that will translate its selection into a selection in a multi-select-enabled listbox. For instance if the strSQL selects TenantID's (1, 9, 34, 52, 190, 315, etc.), when I open the form that contains the listbox, I want the listbox to show each of the records with those TenantID's already selected.
I understand that you can do something like:
Of course this doesn't work because the TenantID's selected in the strSQL aren't actually variables intTenant. Do I need an array for this? How can this be done?
As always, thanks!
Vie
I am trying to write a piece of code to take a strSQL statement (created in code on the fly and saved in a global variable -- i.e., not a saved query) that will translate its selection into a selection in a multi-select-enabled listbox. For instance if the strSQL selects TenantID's (1, 9, 34, 52, 190, 315, etc.), when I open the form that contains the listbox, I want the listbox to show each of the records with those TenantID's already selected.
I understand that you can do something like:
Code:
For x = 0 To Me.lstbox.ListCount - 1
If Me.lstbox.Column(1, x) > intTenantID And Me
.lstbox.Column(1, x) < intTenantID Then
Me.lstbox.Selected(x) = True
End If
Next x
Of course this doesn't work because the TenantID's selected in the strSQL aren't actually variables intTenant. Do I need an array for this? How can this be done?
As always, thanks!
Vie