Go Back   Rhinocerus > Newsgroup > Newsgroup comp.databases.ms-access

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-12-2006, 09:02 PM
timasmith@hotmail.com
Guest
 
Posts: n/a
Default cant get next number

I guess more the fool me for attempting with MS Access but if I execute

select max(nbr) from mytable

nextnbr = maxnbr + 1

insert into mytable (nextnbr...)

multiple times - it appears the first insert is not picked up by the
next select max() - even using the same connection.

Is this due to not having committed i.e. Access query using the same
connection does not show modified data - or is it simply access cannot
register an insert fast enough for the next select?

thanks

Tim

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-12-2006, 11:03 PM
Rich P
Guest
 
Posts: n/a
Default Re: cant get next number

If I read you correctly, it sounds like you want to get the next
autonumber. If this is the case, you can't rely on autonum + 1 because
if there is a deletion in the table, that will throw off the
autonumbers. I think that you can only get Identity/Autonumbers from an
enterprise system like sql server, Oracle, ... where they have a
specific object called @@Identity for retrieving the next
Identity/autonumber value. I don't think Access has this capability
since it is not an enterprise system. Maybe I am wrong here - not sure.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Reply With Quote
  #3 (permalink)  
Old 06-13-2006, 07:59 AM
Terry Kreft
Guest
 
Posts: n/a
Default Re: cant get next number

Sounds to me like you're doing something wrong.

Try posting real code not meaningless snippets and we mght be able to tell
you where you're going wrong.



--

Terry Kreft


<timasmith@hotmail.com> wrote in message
news:1150146149.181072.93410@h76g2000cwa.googlegro ups.com...
> I guess more the fool me for attempting with MS Access but if I execute
>
> select max(nbr) from mytable
>
> nextnbr = maxnbr + 1
>
> insert into mytable (nextnbr...)
>
> multiple times - it appears the first insert is not picked up by the
> next select max() - even using the same connection.
>
> Is this due to not having committed i.e. Access query using the same
> connection does not show modified data - or is it simply access cannot
> register an insert fast enough for the next select?
>
> thanks
>
> Tim
>



Reply With Quote
  #4 (permalink)  
Old 06-13-2006, 06:11 PM
RoyVidar
Guest
 
Posts: n/a
Default Re: cant get next number

Rich P wrote in message <%omjg.34$0n1.38910@news.uswest.net> :
> If I read you correctly, it sounds like you want to get the next
> autonumber. If this is the case, you can't rely on autonum + 1
> because if there is a deletion in the table, that will throw off the
> autonumbers. I think that you can only get Identity/Autonumbers from
> an enterprise system like sql server, Oracle, ... where they have a
> specific object called @@Identity for retrieving the next
> Identity/autonumber value. I don't think Access has this capability
> since it is not an enterprise system. Maybe I am wrong here - not
> sure.
>
> Rich
>
> *** Sent via Developersdex http://www.developersdex.com ***


With regards to Jet 4.0 and @@identity, have a look here;
http://support.microsoft.com/kb/232144/en-us

--
Roy-Vidar


Reply With Quote
  #5 (permalink)  
Old 06-15-2006, 05:13 AM
Rich P
Guest
 
Posts: n/a
Default Re: cant get next number

Thanks. That was a great article. Very informative.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Macro variable is not long enough to hold my intended value Nordlund, Dan Newsgroup comp.soft-sys.sas 0 04-16-2008 08:05 PM
Re: Macro variable is not long enough to hold my intended value Sigurd Hermansen Newsgroup comp.soft-sys.sas 0 04-16-2008 08:02 PM
Macro variable is not long enough to hold my intended value SUBSCRIBE SAS-L Dan Newsgroup comp.soft-sys.sas 0 04-16-2008 07:43 PM
Re: Reading Number (?) Data From An External File Rob Rohrbough Newsgroup comp.soft-sys.sas 0 11-22-2005 06:42 PM
Re: How to find the number of lines of SAS code and comments Doug Rohde Newsgroup comp.soft-sys.sas 0 05-06-2005 09:13 PM



All times are GMT. The time now is 01:44 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.