Re: Incrementing a field



Hi J,

You can't put code in the Replace Field dialog on the Table menu.

Are you trying to do this process once for a table you have or are you
trying to do this automatically for every new record you are adding to the
table?

Which version of FoxPro are you using? If you're using a newer version of
FoxPro there is an auto-incrementing Integer field where you can set the
initial value and the increment. If you're using an older version of FoxPro
there are ways to do this but you have to write code and call it every time.

If you only want to do it once try the following in the Command window:

Replace All FieldName With StartValue + ((RecNo() - 1) * 5) In TableName


--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@xxxxxxx www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden


"jjoseph" <jjoseph@xxxxxxxxx> wrote in message
news:1131744141.663877.88490@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Wanting to know if it possible to set initial value typeN of a field in
> record 1 and then increment each record of that field by 5.
> exp
> field
> record 1 1000
> record 2 1005
> so on
>
> I am very new to foxpro but if it is possible i believe it takes code
> which i would be place in the "'with" tab under the replace fields
> button
> TIA
>


.


Loading