Subject |
Re: autoincrement problem |
From |
Ken Mayer <dbase@nospam.goldenstag.net> |
Date |
Tue, 17 Oct 2023 05:11:19 -0700 |
Newsgroups |
dbase.getting-started |
On 10/16/2023 11:35 PM, Charlie wrote:
> Hi Ken... Thanks.. I tried that as an xdml function with a variable and then a hard number as below.. Doesn't seem to work for me. Does the same thing. New number is starting over. Any suggestions?
>
> I did have success in dropping the field and then creating it again but that doesn't seem to be very code friendly.
>
> function alttab()
> private x
> x = 0
> use floss.dbf
> go bottom
> x = lr +1
> close tables
> set procedure to :dUFLP:DBF7File.CC
> oDBF7File = new DBF7File( "floss.dbf" )
> oDBF7File.SetNextAutoIncValue( 293 )
> oDBF7File = null
> close procedure :dUFLP:DBF7File.cc
> return
>
About all I can suggest is trying to add the fieldname (the method
allows for it, but it shouldn't be necessary):
oDBF7File.SetNextAutoIncValue( "lr", x )
That said, once you have set it, you shouldn't need to do it again, so
the use of the function is overkill. This should be a one-time thing to
fix the value in the header of the .dbf file. If you are constantly
changing it, then you are giving yourself a lot more heartburn than
necessary.
As Mervyn notes, maybe we need to see your append code ... because
honestly this should take care of the issue.
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm
|
|