Question:
We are using SalesLogix LAN v7.2.1 with a table, myTableA, that has a field "Division". I want to be able to load the distinct values in the "Division" field in myTableA in a combobox (cmbDivision). Any idea how I can do this?
I could always hard code it:
cmbDivision.Items.Add("Retail")
cmbDivision.Items.Add("Government")
etc. but I would always need to update the code whenever a new division was added to the table.
Answer:
You can Query the DB:
'Assumption: adCon = ADODB.Connection object and adRec = ADODB.Recordset object. adCon has already been initialized and opened
Set adRec = adCon.Execute("select distinct division from TABLE")
Do While not adRec.EOF
cmdDivision.Items.add(adRec(0).Value & "")
adRec.MoveNext
Loop