Modifying a Datagrid to Return Specific Data in SalesLogix v6.2.6

Question: I’m working on modifying a datagrid to return only data for a specific
record in SalesLogix v6.2.6.  I’m receiving the following error when I
attempt to open the datagrid: ” Invalid column name ”
strVal ” at line 20, char1.  This is the code I’m using:

Sub AXFormOpen(Sender)
dim strSQL
dim strVal
strVal = Application.GlobalInfo.TempShipFrom

datagrid1.Active = true

strSQL
=”SELECT DISTINCT A1.ACCOUNT_SHIPFROMID, A1.SHIP_FROM_NO, A1.ADDRESS1,
A1.ADDRESS2, A1.CITY, A1.STATE, A1.POSTALCODE FROM ACCOUNT_SHIPFROM A1
WHERE A1.AccountID = “”‘ & strVal & ‘”””

datagrid1.SQL.Text = strSQL

datagrid1.Refresh

Application.GlobalInfo.TempShipFrom = “”
End Sub

Any idea why I’m getting this error?

 
Answer: “”‘ & strVal & ‘”””  should be ‘” & strVal & “‘”

The
‘ goes into SQL to enclose the acountid. The ” closes the first
part of the string. At the end “‘” adds a single ‘ to the SQL to close
the quote around the ID.  This makes a huge difference when parsed for SQL.

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) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!