Re: Select - SQL vs. SUM
From: Fred Taylor (ftaylor_at_mvps.org!REMOVE)
Date: 03/21/05
- Previous message: Fred Taylor: "Re: Grabbing an email Address from a Form"
- In reply to: Subhash Chopra: "Re: Select - SQL vs. SUM"
- Next in thread: Jan: "Re: Select - SQL vs. SUM"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 21 Mar 2005 14:24:12 -0700
If you have to use an earlier version of VFP earlier than 9, you can process
the commands from the table in a SCAN loop and add them to a cursor and use
the cursor as the control source for those fields.
-- Fred Microsoft Visual FoxPro MVP "Subhash Chopra" <s.chopra@rogers.com> wrote in message news:5f2dneR2GKB1kqLfRVn-1w@rogers.com... > But I am using VFP 6.0. What are the options in this case. > > Subhash. > > "Anders Altberg" <x_pragma@telia.com> wrote in message > news:#dNIoxNLFHA.656@TK2MSFTNGP14.phx.gbl... >> SQL SELECT doesn't read the buffered data in the Grid, it reads direct > from >> disk. In VFP9 you can SET SQLBUFFERINFG ON to change this defaut. You can >> also force VFP to read from the buffer with a new clause in the SQL > SELECT >> command, SELECT <field> WITH BUFFERING=.T. FROM Table. >> The SELECT command doesn't move the record pointer in the grid's record >> source. The3 SUM command does. >> -Anders >> >> "Subhash" <Subhash@discussions.microsoft.com> wrote in message >> news:38914C6F-DFD6-44D8-A038-98BE9564D721@microsoft.com... >> > I have a grid whose recordsource is a table named _payments. In this > table >> > there is a column in which user enters the amount of payment received > for >> the >> > respective invoice. This column is no. 8 in the grid and is the last >> column. >> > The table contains outstanding invoices for a particular customer. >> > >> > In the lostfocus event of the the column, I placed the following code: >> > >> > Thisform.txtUnused.refresh >> > >> > The txtUnused is a text box that displays the unused portion of the > total >> > payment received from that customer. The Text Box has its controlsource >> set >> > to nBalance. I place the following code in Refresh Event of txtUnused: >> > >> > Select _Payments >> > sum Thispmt to TotalPmt >> > nBalance=nPayment-TotalPmt && nPayment is the total payment received. >> > Select Customer >> > >> > This code works fine the way it is. However, when I change the code to > a >> > SELECT-SQL statement, I run into a weird behaviour. The SQL code reads: >> > >> > Select sum(Thispmt) from _payments into array TotalPmt >> > nBalance=nPayment-TotalPmt >> > >> > With the SQL statement when I change the value in ThisPmt column for >> > the >> > first time and hit Enter key, the value in txtUnused is updated and the >> focus >> > moves the 1st column in the grid which is a Checkbox control. Now, >> > while >> > staying on the same row if I navigate to the last column and change the >> value >> > again, the txtUnused doesn't get updated. Except for the first time, no >> > matter how many times I change the value in the ThisPmt column, the >> txtUnused >> > stays the same as the first time value. When I press down arrow key and >> then >> > up arrow again, then the value gets updated. >> > >> > With the SUM statement, it works perfectly fine. As soon the value is >> > changed in that column and I press Enter Key, the value in txtUnused > gets >> > updated and focus moves to 2nd column in stead of 1st column as was the >> case >> > when I use Select SQL statement. >> > >> > Can someone please explain this to me why it is happening the way it >> > is. > I >> > would prefer to use the SQL SELECT in stead of SUM statement. >> > >> > Thanks a lot in advance. >> > >> > -- >> > Subhash Chopra >> > VFP 6.0, WIN XP PRO >> > >> > >> > >> > >
- Previous message: Fred Taylor: "Re: Grabbing an email Address from a Form"
- In reply to: Subhash Chopra: "Re: Select - SQL vs. SUM"
- Next in thread: Jan: "Re: Select - SQL vs. SUM"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|