Autonumber....

  • Thread starter Thread starter Guest
  • Start date Start date
G

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,
 
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.
 
Well I dont mind writing a code but I dont really know where to start....Can
you help me with that...

Thank you
 
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 said:
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
 
dcash45 said:
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
 
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....
 
dcash45 said:
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.
 
dcash45 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top