Information générale
Catégorie:
Codage, syntaxe et commandes
>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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement