Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using GRID to enter data
Message
 
 
À
09/04/2008 12:51:28
Fabian Borghi
Xenon Information Technology
Itaparica, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01309223
Message ID:
01309576
Vues:
7
>
>IF !EMPTY(THISFORM.combo1.VALUE)
>	PUBLIC x_consmat && Do you really need public variable?
>	x_consbim = ALLTRIM(STR(THISFORM.optiongroup1.VALUE))
>	x_consmat = ALLTRIM(THISFORM.combo1.VALUE)
>
>
>	IF THISFORM.combo1.VALUE="99"
>	ELSE
>*SET STEP ON
>
>		IF inlist(THISFORM.optiongroup1.VALUE, 1,2,3,4)
>
>
>			x_strsql = "select dados.matricula,dados.nome, " + "notas.t" + x_consmat + " as teste ," + ;
>				"notas.p" + x_consmat + " as prova ," + ;
>				"notas.q" + x_consmat + " as qualit ," + ;
>				"notas.o" + x_consmat + " as outros from dados,notas into dbf tempnota where notas.serie = " + THISFORM.combo2.VALUE + " .and." + ;
>				" notas.bimestre = " + x_consbim + " .and. notas.matricula = dados.matricula"
>			&x_strsql
>		
>			ALTER TABLE tempnota ADD COLUMN Total n(5,2)
>			
>			thisform.grid1.RecordSourceType=0
>			thisform.grid1.RecordSource = "tempnota"
>
>						
>			thisform.grid1.ColumnCount = 7
>			thisform.grid1.column1.Width= 0
>			thisform.grid1.column2.Width= 300
>			thisform.grid1.column3.Width= 50
>			thisform.grid1.column4.Width= 50
>			thisform.grid1.column5.Width= 50
>			thisform.grid1.column6.Width= 50
>			thisform.grid1.column7.Width= 50
>
>			thisform.grid1.column2.header1.Caption="Nome"
>			thisform.grid1.column3.header1.Caption="Teste"
>			thisform.grid1.column4.header1.Caption="Prova"
>			thisform.grid1.column5.header1.Caption="Qualit."
>			thisform.grid1.column6.header1.Caption="Outras"
>			thisform.grid1.column7.header1.Caption=""
>			
>			thisform.grid1.column3.ControlSource = "Tempnota.teste"
>			thisform.grid1.column4.ControlSource = "Tempnota.prova"
>			thisform.grid1.column5.ControlSource = "Tempnota.qualit"
>			thisform.grid1.column6.ControlSource = "Tempnota.outros"
>			thisform.grid1.column7.ControlSource = "Tempnota.teste+Tempnota.prova+Tempnota.qualit+Tempnota.outros"
>					
>		ELSE
>
>		ENDIF
>	ENDIF
>ENDIF
>
>thisform.combo1.Enabled= .F.
>thisform.command2.Enabled= .T.
>thisform.grid1.Visible= .T.
>
I tried to change your code, but I then stopped. In your case it's much better to use safe select approach.

Create a cursor to be the source of the grid in the form's load with Create cursor command.

When you change the combobox value, just select new data (and you don't need macro here) into temp cursor. ZAP the original cursor and append from the temp cursor (actually you can do insert into myGridCursor select ... after zapping).

This way I believe your form and grid would function without problems.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform