Turn off AutoInc outside a form??? 
Author Message
 Turn off AutoInc outside a form???

I know that in a form I can call Access:Filename.CancelAutoInc to turn off
AutoInc. How do I do this if I'm adding a record from somewhere else besides
the form. There are times that I need to assign my own value and not allow
AutoInc.

Any thoughts?

Thanks - Ed Campbell



Fri, 25 Feb 2005 13:23:23 GMT  
 Turn off AutoInc outside a form???
Use a "legacy" ADD?

--

Steve Parker

--------------------------------------------------
kb and download center at:
     www.par2.com
--------------------------------------------------


Quote:
> I know that in a form I can call Access:Filename.CancelAutoInc to turn off
> AutoInc. How do I do this if I'm adding a record from somewhere else
besides
> the form. There are times that I need to assign my own value and not allow
> AutoInc.

> Any thoughts?

> Thanks - Ed Campbell



Fri, 25 Feb 2005 13:23:24 GMT  
 Turn off AutoInc outside a form???
I'm pretty sure Access:Filename.Insert will let you specify a value for the
autoinc field, if you leave it blank then it calls PrimeAutoInc.


Quote:
> I know that in a form I can call Access:Filename.CancelAutoInc to turn off
> AutoInc. How do I do this if I'm adding a record from somewhere else
besides
> the form. There are times that I need to assign my own value and not allow
> AutoInc.

> Any thoughts?

> Thanks - Ed Campbell



Fri, 25 Feb 2005 13:24:06 GMT  
 Turn off AutoInc outside a form???
I use this code for specifying the first number, it should work else too.

  Access:Orders.PrimeFields()
  Access:Orders.PrimeAutoInc() !Prime first
  If Records(Ordrer)=0
     Order:Order=1000              !Then change to my startnumber
  .



Quote:
> I'm pretty sure Access:Filename.Insert will let you specify a value for
the
> autoinc field, if you leave it blank then it calls PrimeAutoInc.



> > I know that in a form I can call Access:Filename.CancelAutoInc to turn
off
> > AutoInc. How do I do this if I'm adding a record from somewhere else
> besides
> > the form. There are times that I need to assign my own value and not
allow
> > AutoInc.

> > Any thoughts?

> > Thanks - Ed Campbell



Fri, 25 Feb 2005 13:24:41 GMT  
 Turn off AutoInc outside a form???
Ummm, do you have any more infomation on this? I can't find anything that
lets me stop PrimeAutoInc from being called when a record is inserted.

Thanks - Ed


Quote:
> I'm pretty sure Access:Filename.Insert will let you specify a value for
the
> autoinc field, if you leave it blank then it calls PrimeAutoInc.



> > I know that in a form I can call Access:Filename.CancelAutoInc to turn
off
> > AutoInc. How do I do this if I'm adding a record from somewhere else
> besides
> > the form. There are times that I need to assign my own value and not
allow
> > AutoInc.

> > Any thoughts?

> > Thanks - Ed Campbell



Fri, 25 Feb 2005 13:25:11 GMT  
 Turn off AutoInc outside a form???
Ed,

There are a couple of ways to do this.

Method 1: Use for a one time kind of thing

Access:MyFile.PrimeAutoInc()  !This will create a record and do the
auto-increment.

!Set your record buffer here including the auto-increment field value that
you really want.

Access:MyFile.Insert()  !This won't do the auto-inc because it thinks it has
already been done. It will do a PUT.

Method 2: More work but allows some generic programming.

1. Derive your own FileManager class and override both the TryPrimeAutoInc
and PrimeAutoInc methods.
2. Add a SkipAutoInc Property to your new class.
3. In the methods test Self.SkipAutoInc and if true do an ADD(Self.File). If
SkipAutoInc is false call the Parent method.
4. In your code set the SkipAutoInc flag to true before calling
Access:MyFile.Insert().

HTH,
Rick Martin
Sharpe Software, Inc.


Quote:
> I know that in a form I can call Access:Filename.CancelAutoInc to turn off
> AutoInc. How do I do this if I'm adding a record from somewhere else
besides
> the form. There are times that I need to assign my own value and not allow
> AutoInc.

> Any thoughts?

> Thanks - Ed Campbell



Fri, 25 Feb 2005 13:25:19 GMT  
 Turn off AutoInc outside a form???
Ooops!  Sorry, I am mistaken, try Bjarne's suggestion, or Steve's.


Quote:
> Ummm, do you have any more infomation on this? I can't find anything that
> lets me stop PrimeAutoInc from being called when a record is inserted.

> Thanks - Ed



> > I'm pretty sure Access:Filename.Insert will let you specify a value for
> the
> > autoinc field, if you leave it blank then it calls PrimeAutoInc.



> > > I know that in a form I can call Access:Filename.CancelAutoInc to turn
> off
> > > AutoInc. How do I do this if I'm adding a record from somewhere else
> > besides
> > > the form. There are times that I need to assign my own value and not
> allow
> > > AutoInc.

> > > Any thoughts?

> > > Thanks - Ed Campbell



Fri, 25 Feb 2005 13:25:27 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Temporarly set the AutoInc Flag runtime to off?

2. turning off backdrop ?

3. Turn Computer off with RB

4. RTF - Can't turn off ISDIRTY=TRUE

5. Turning off pc speaker

6. Turn off mask for browse...

7. Turn off right click popup

8. CW55 turn off list control marking

9. Turning off flat button option - where is it??

10. XP turning off backing up files afer I/O

11. How do you turn off Progress screen in C4 ABC

12. Turning F1 off

 

 
Powered by phpBB® Forum Software