Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Autonumber....

Discussion in 'Information Technology' started by dcash45, Jul 28, 2006.

Tags:
  1. dcash45

    dcash45
    Expand Collapse
    Guest

    Hi Im trying to add 1 to my userID every time a new record is added. The
    thing is that I don’t want to use access autonumber because one of the thing
    is that it starts from 1. My userID start from 3000001 and the userID data
    type is number. So I wanted to know if anyone can help me with this problem.
    How can I add 1 every time a new record is added to the table automatic?

    Thank you,
     
  2. ChrisM

    ChrisM
    Expand Collapse
    Guest

    People will tell you that AutoNumber should not be used for anything that
    has a 'meaning' to the user. (like a User Id for example).
    However, if you want the number generated automatically, and don't want to
    write any code, it is the best (if not only) way to do this.
    If you insert a record with the value "3000000" into your AutoNum field,
    then the next AutoNum to be generated by Access will be the required
    3000001.

    Cheers,

    Chris.

    "dcash45" <dcash45@discussions.microsoft.com> wrote in message
    news:A9785464-64B3-4B26-ACF5-65E6C0523D6F@microsoft.com...
    > Hi Im trying to add 1 to my userID every time a new record is added. The
    > thing is that I don't want to use access autonumber because one of the
    > thing
    > is that it starts from 1. My userID start from 3000001 and the userID
    > data
    > type is number. So I wanted to know if anyone can help me with this
    > problem.
    > How can I add 1 every time a new record is added to the table automatic?
    >
    > Thank you,
    >
     
  3. dcash45

    dcash45
    Expand Collapse
    Guest

    Well I dont mind writing a code but I dont really know where to start....Can
    you help me with that...

    Thank you

    "ChrisM" wrote:

    > People will tell you that AutoNumber should not be used for anything that
    > has a 'meaning' to the user. (like a User Id for example).
    > However, if you want the number generated automatically, and don't want to
    > write any code, it is the best (if not only) way to do this.
    > If you insert a record with the value "3000000" into your AutoNum field,
    > then the next AutoNum to be generated by Access will be the required
    > 3000001.
    >
    > Cheers,
    >
    > Chris.
    >
    > "dcash45" <dcash45@discussions.microsoft.com> wrote in message
    > news:A9785464-64B3-4B26-ACF5-65E6C0523D6F@microsoft.com...
    > > Hi Im trying to add 1 to my userID every time a new record is added. The
    > > thing is that I don't want to use access autonumber because one of the
    > > thing
    > > is that it starts from 1. My userID start from 3000001 and the userID
    > > data
    > > type is number. So I wanted to know if anyone can help me with this
    > > problem.
    > > How can I add 1 every time a new record is added to the table automatic?
    > >
    > > Thank you,
    > >

    >
    >
    >
     
  4. ChrisM

    ChrisM
    Expand Collapse
    Guest

    Hi,

    Sorry, but I'm not really in a postion to give a masterclass on VBA
    programming.
    Don't really do much coding in Acess anyway, most of my programming is C#.
    Just use Access (Jet) as a backend.

    Hopefully one of the lovely MVPs in this group will be able to point you to
    some resources to get you started.

    In the meantime, you could try this:
    http://tinyurl.com/mwfs8
    (Google search for 'Programming MS Access')

    Cheers,

    Chris.

    "dcash45" <dcash45@discussions.microsoft.com> wrote in message
    news:50C43FAC-6D43-41B8-AC94-65A06D752C8B@microsoft.com...
    > Well I dont mind writing a code but I dont really know where to
    > start....Can
    > you help me with that...
    >
    > Thank you
    >
    > "ChrisM" wrote:
    >
    >> People will tell you that AutoNumber should not be used for anything that
    >> has a 'meaning' to the user. (like a User Id for example).
    >> However, if you want the number generated automatically, and don't want
    >> to
    >> write any code, it is the best (if not only) way to do this.
    >> If you insert a record with the value "3000000" into your AutoNum field,
    >> then the next AutoNum to be generated by Access will be the required
    >> 3000001.
    >>
    >> Cheers,
    >>
    >> Chris.
    >>
    >> "dcash45" <dcash45@discussions.microsoft.com> wrote in message
    >> news:A9785464-64B3-4B26-ACF5-65E6C0523D6F@microsoft.com...
    >> > Hi Im trying to add 1 to my userID every time a new record is added.
    >> > The
    >> > thing is that I don't want to use access autonumber because one of the
    >> > thing
    >> > is that it starts from 1. My userID start from 3000001 and the userID
    >> > data
    >> > type is number. So I wanted to know if anyone can help me with this
    >> > problem.
    >> > How can I add 1 every time a new record is added to the table
    >> > automatic?
    >> >
    >> > Thank you,
    >> >

    >>
    >>
    >>
     
  5. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    dcash45 wrote:
    > Hi Im trying to add 1 to my userID every time a new record is added.
    > The thing is that I don't want to use access autonumber because one
    > of the thing is that it starts from 1. My userID start from 3000001
    > and the userID data type is number. So I wanted to know if anyone
    > can help me with this problem. How can I add 1 every time a new
    > record is added to the table automatic?
    >
    > Thank you,


    Try taking a look at:


    http://www.databasedev.co.uk/automatically_increment_value.html

    --
    Joseph Meehan

    Dia duit
     
  6. Tony Toews

    Tony Toews
    Expand Collapse
    Guest

    dcash45 <dcash45@discussions.microsoft.com> wrote:

    >Hi Im trying to add 1 to my userID every time a new record is added. The
    >thing is that I don’t want to use access autonumber because one of the thing
    >is that it starts from 1. My userID start from 3000001 and the userID data
    >type is number. So I wanted to know if anyone can help me with this problem.
    > How can I add 1 every time a new record is added to the table automatic?


    Set AutoNumbers to start from ...
    http://allenbrowne.com/ser-26.html

    Tony
    --
    Tony Toews, Microsoft Access MVP
    Please respond only in the newsgroups so that others can
    read the entire thread of messages.
    Microsoft Access Links, Hints, Tips & Accounting Systems at
    http://www.granite.ab.ca/accsmstr.htm
     
  7. dcash45

    dcash45
    Expand Collapse
    Guest

    Hi Joseph thanks a lot for the site....but do u know if theres away to add 1
    to a ID base on who opened the form 1st...so there will not be a problem if 2
    or more users was to try and add a record at the same time....

    "Joseph Meehan" wrote:

    > dcash45 wrote:
    > > Hi Im trying to add 1 to my userID every time a new record is added.
    > > The thing is that I don't want to use access autonumber because one
    > > of the thing is that it starts from 1. My userID start from 3000001
    > > and the userID data type is number. So I wanted to know if anyone
    > > can help me with this problem. How can I add 1 every time a new
    > > record is added to the table automatic?
    > >
    > > Thank you,

    >
    > Try taking a look at:
    >
    >
    > http://www.databasedev.co.uk/automatically_increment_value.html
    >
    > --
    > Joseph Meehan
    >
    > Dia duit
    >
    >
    >
     
  8. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    dcash45 wrote:
    > Hi Joseph thanks a lot for the site....but do u know if theres away
    > to add 1 to a ID base on who opened the form 1st...so there will not
    > be a problem if 2 or more users was to try and add a record at the
    > same time....


    Good question. I have never personally used the procedure so I never
    tested it. Hopefully someone with better knowledge of the inner workings of
    Access or experience with the process can help.

    >
    > "Joseph Meehan" wrote:
    >
    >> dcash45 wrote:
    >>> Hi Im trying to add 1 to my userID every time a new record is added.
    >>> The thing is that I don't want to use access autonumber because one
    >>> of the thing is that it starts from 1. My userID start from 3000001
    >>> and the userID data type is number. So I wanted to know if anyone
    >>> can help me with this problem. How can I add 1 every time a new
    >>> record is added to the table automatic?
    >>>
    >>> Thank you,

    >>
    >> Try taking a look at:
    >>
    >>
    >> http://www.databasedev.co.uk/automatically_increment_value.html
    >>
    >> --
    >> Joseph Meehan
    >>
    >> Dia duit


    --
    Joseph Meehan

    Dia duit
     
  9. Tony Toews

    Tony Toews
    Expand Collapse
    Guest

    dcash45 <dcash45@discussions.microsoft.com> wrote:

    >Hi Joseph thanks a lot for the site....but do u know if theres away to add 1
    >to a ID base on who opened the form 1st...so there will not be a problem if 2
    >or more users was to try and add a record at the same time....


    Generally, if you use autonumbers, that won't be a problem. Access
    will very briefly lock the table while it is creating the new record
    and then unlock it for the next person to create their own record.

    Unless your users are adding a lot of records in a short period of
    time this shouldn't be a problem.

    Tony
    --
    Tony Toews, Microsoft Access MVP
    Please respond only in the newsgroups so that others can
    read the entire thread of messages.
    Microsoft Access Links, Hints, Tips & Accounting Systems at
    http://www.granite.ab.ca/accsmstr.htm
     
  10. dcash45

    dcash45
    Expand Collapse
    Guest

    Thanks Tony...this can help me with some of the forms Im working on....

    "Tony Toews" wrote:

    > dcash45 <dcash45@discussions.microsoft.com> wrote:
    >
    > >Hi Im trying to add 1 to my userID every time a new record is added. The
    > >thing is that I don’t want to use access autonumber because one of the thing
    > >is that it starts from 1. My userID start from 3000001 and the userID data
    > >type is number. So I wanted to know if anyone can help me with this problem.
    > > How can I add 1 every time a new record is added to the table automatic?

    >
    > Set AutoNumbers to start from ...
    > http://allenbrowne.com/ser-26.html
    >
    > Tony
    > --
    > Tony Toews, Microsoft Access MVP
    > Please respond only in the newsgroups so that others can
    > read the entire thread of messages.
    > Microsoft Access Links, Hints, Tips & Accounting Systems at
    > http://www.granite.ab.ca/accsmstr.htm
    >
     

Share This Page