Running Query SalesLogix and Displaying Results in the cboProductType

Question: In SalesLogix I am trying to run a query, and after the query is
executed I would like the results to be displayed in the field
cboProductType.  I applied the following code to my form but it’s not
working:

Sub cboProductTypeChange(Sender)

dim oCon
dim oRS
dim strSQL
Set oCon = Application.GetNewConnection
strSQL = “SELECT DISTINCT(ORDER_FAMILY) FROM BIP_ORDER_HEADERS WHERE ORDER_FAMILY IS NOT NULL”

While Not oRS.EOF
cboProductType.Items.Add(oRs.Fields(“ORDER_FAMILY”).Value)
oRS.MoveNext
WEnd
End Sub

 
What am I missing?
 
Answer: After you set strSQL you need to populate your result set:

 

Set oRS = oCon.Execute(strSQL)

When you are finished with
your objects be sure to close and dispose of them.  If a sub is
repeatedly called the cbo items append over and over, so consider adding
this as well: cboProductType.Items.Clear

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!