General information
Category:
Coding, syntax & commands
>>Can anyone tell me what's wrong with the following code fragment?
>>
>>local lcSQLCmd
>>
>>with this.grdLookup
>> .recordsource = ""
>>
>> lcSQLCmd = "select * from MASTCUS into cursor C_MASTCUS"
>> lcSQLCmd = lcSQLCmd + thisform.SQLFilter
>> &lcSQLCmd
>>
>> .recordsource = "C_MASTCUS"
>> .columns[1].controlsource = "C_MASTCUS.CNAME"
>> .columns[2].controlsource = "C_MASTCUS.CADDR"
>> .columns[3].controlsource = "left(C_MASTCUS.CCITY,17)"
>> .columns[4].controlsource = "right(C_MASTCUS.CCITY,2)"
>> .columns[5].controlsource = "C_MASTCUS.CZIPCD"
>> .columns[6].controlsource = "round(val(C_MASTCUS.CCUST),0)"
>> .columns[7].controlsource = "mvPhone(C_MASTCUS.CPHONE, .T.)"
>> .columns[8].controlsource = "C_MASTCUS.CDBANAME"
>> .columns[9].controlsource = "C_MASTCUS.CLICNM"
>> .columns[10].controlsource = "C_MASTCUS.CMGR"
>> .columns[11].controlsource = "C_MASTCUS.COWNER"
>>endwith
>>
>>When I run this code I get an error on the line .columns[10].controlsource, etc.
>>If I comment out .columns[10] & .columns[11], no error!
>>If I comment out .columns[8] & .columns[9] and renumber .columns[10] & .columns[11], TO .columns[8] & .columns[9], no error!
>>
>>Any Ideas?
>
>
>After setting the recordsource for the grid set the columncount to 11. The grid is just making a best guess as to how many of the fields from the query you are going to be using in it. e.g. You are using CCITY 2 times and it is only going to expect this to be used once.
>HTH
I haven't worked with this before so this is a REAL SWAG and maybe really wrong.
but............
Is it possible that the column reference numbers begin with 0 and not 1?? That way .columns[10] would not exist???
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only