The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Datagrid Invalid Column Name
Posted: 03 Apr 08 12:46 PM
|
Hi! A newbie here again! I am trying to modify a datagrid so that it will only give me data for a specific account record. When I try to open the datagrid I get the following error" Invalid column name " strVal " at line 20, char1. Can someone please look at my code and tell me what I am doing wrong? I am using Saleslogix version 6.2.6.1007. Thanks in advance! My code: 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
|
|
|
|
Re: Datagrid Invalid Column Name
Posted: 03 Apr 08 12:54 PM
|
""' & strVal & '"""
should be
'" & strVal & "'"
The ' goes into the 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.
Looks pretty much the same to us but it makes all the difference in the world when parsed for SQL. |
|
|
|
Re: Datagrid Invalid Column Name
Posted: 03 Apr 08 1:05 PM
|
Thanks! That worked!!!
Any idea why my data isn't being displayed in the datagrid though? I know that at least one record should show up. Is there something in the datagrid properties that need to be set that I am missing? Thanks again! |
|
|
|
Re: Datagrid Invalid Column Name
Posted: 03 Apr 08 1:55 PM
|
Add the line
msgbox "accountid is " & strVal
to the code above to make sure you're reading the global variable properly. |
|
|
|
Re: Datagrid Invalid Column Name
Posted: 03 Apr 08 3:09 PM
|
Thanks! Everything is working now. I also had to add the AccountID as a hidden column on the datagrid and then my data appeared.
|
|
|
|