Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put a total on a text box? 1

Status
Not open for further replies.

renante

Technical User
Jul 13, 2001
7
CA
I am a beginner of vfp6, I have a grid and a textbox, i wanted my textbox to add all the records i entered in one certain column of the grid.
And also what is the command to give a specification on the page of the report that only certain pages will be printed.
thank you in advance!
 
Hi
Assumed.. Name of textBox=TxtBox1
Name of field to be added=myField

In the Grids .. AfterRowColChangeEvent .. put the code..

LOCAL myRecNo, nTotal
myRecNo = RECNO()
TOTAL myField TO nTotal
ThisForm.txtBox1.Value = nTotal
ThisForm.txtBox1.Refresh()
GO myRecNo

Now the total shall be displayed everytime you change a value in the myField.

Regarding printing.. please post it again with more details of your requirement.

Hope this helps you. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Mr. Ramani,

I have tried your suggestion and encoded the following:

LPARAMETERS nColIndex
local myrecno,nTotal
myrecno=recno()&&having problems with this line)
total grdtxtdr to ntotal
thisform.txttotaldr.value=ntotal
thisform.txttotaldr.refresh()
go myrecno

grdtxtdr is the name of my textbox in the grid, what should i put the tablename.field?
thanks
Renante
 
I am not sure if your default alias is the Grids alias.
To reslve this issue...

In the Grids .. AfterRowColChangeEvent .. cut & paste the following code...
*************************************
LPARAMETERS nColIndex

local myrecno,nTotal, lcAlias
lcAlias = ALIAS()

SELECT (This.RecordSource)
myrecno=recno() &&having problems with this line)
total grdtxtdr to ntotal
thisform.txttotaldr.value=ntotal
thisform.txttotaldr.refresh()
go myrecno

SELECT (lcAlias)
************************************

Hope this helps... ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top