Re: Why does my record pointer move
From: Subhash (Subhash_at_discussions.microsoft.com)
Date: 03/18/05
- Next message: Jeff Grippe: "Re: Large Lists - Please read and comment"
- Previous message: Tim Witort: "Re: VFP9 bug (was: Slight VFP9 oddity)"
- In reply to: Ian Sim***: "Re: Why does my record pointer move"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Mar 2005 10:13:01 -0800
Thanks everyone for responding.
Ian hit the nail on the bud. That is exactly what is happenning. The total I
get is 68 times the Amount of the current record in Invoices table. I now
have two choices here. Either do a Select Invoices and Select Customer
before and after the Sum command or use SQL Select statement as suggested by
Andrew.
Thanks again.
Subhash
"Ian Sim***" wrote:
> Hi Subhash.
>
> What you are telling FoxPro to do here is go through all the records in the
> current table (Customer) and for each record add up the value of the Amount
> field of Invoices. not knowing how you have things related I can't say what
> sort of total you'll get, but it's a safe bet it isn't what you want. If
> Customer is the parent of the Customer -> Invoices relationship then you'll
> get the total of the amount on the first invoice of every customer. In that
> case you should select the Invoices table and sum the Amount FOR records
> that match the Customer ID, or if you have just moved the record pointer in
> the customer table and so know that the Invoice table will be pointing to
> the first record you can sum it WHILE the ID matches.
>
> The important thing to remember is that all commands work on the currently
> sleeted table unless specifically made to work elsewhere by an IN clause or
> something similar.
>
> Ian Sim***.
>
>
> "Subhash" <Subhash@discussions.microsoft.com> wrote in message
> news:73F48FC3-A637-4325-9E79-4CB483C66E69@microsoft.com...
> > I have a form which has a Data Environment that opens 8 tables and all of
> the
> > tables are related to each other. In Click Event of one of the buttons on
> the
> > form, I place the following code:
> >
> > ? Alias(), Recno()>>>>>>>Displays Customer, 5
> > Sum Invoices.Amount to TotalAmt
> > ? Alias(), Recno()>>>>>>>Displays Customer, 69
> >
> > Customer table has only 68 records. The record pointer moves to End of
> File.
> > If I comment out the Sum command, then it gives identical results.
> >
> > Can someone explain this behaviour.
> >
> > Thanks.
> >
> > --
> > Subhash Chopra
> > VFP 6.0, WIN XP PRO
>
>
>
- Next message: Jeff Grippe: "Re: Large Lists - Please read and comment"
- Previous message: Tim Witort: "Re: VFP9 bug (was: Slight VFP9 oddity)"
- In reply to: Ian Sim***: "Re: Why does my record pointer move"
- Messages sorted by: [ date ] [ thread ]