Next Number is...

  • Thread starter Thread starter mloucel
  • Start date Start date
M

mloucel

I am a beguiner, I have done a couple of things in Access not a bi
deal, but now my boss wants something I have no Idea what to do, thi
is the scenario
- A database 12 fields.
- 1 Field is called Folder Number (entered manually so far
there is the problem he wants that particular field to change to th
next number automagically as soon as the user click the button save
this button was created using Access own resources (create a butto
and on the button wizard choose record operations and then save
record)
How can I add code so when the user click on save it will read th
last number on the field and add 1, then save the record
also is there any way to display the content of the field but avoi
the users from clicking and making changes on that field.
I'm wondering on the most easy child like type of code, that works..
no fancy work just simple and easy
Thanks for any help.

Maurice.
 
Bonjour Maurice,
Just to be picky ... you have a database containing one table. The table
contains 12 fields.
OK, make your Folder number an AutoNumber field (that's a Data Type when you
create the table). It will increment automatically every time you create a
new folder. The numbers will go 1, 2, 3, etc. If you want your own number
sequence that's more difficult.
You don't have to save in Access. When you move out of a record it is
written to the table automatically. There is no need for a Save button.
To stop users from making changes to a field, go to the field's properties
and change "Locked" to Yes. I would also recommend that you change "Tab
stop" to No so that when the user uses the Tab key, he'll skip over that
field.

Michel
I have a free tutorial on Access that you might want to check out. It's in
French too, if that helps.
www.profsr.com Profsr.com Tutorials
 
Uniquely identify your records by using an AutoNumber value as the
identification field for the record. That will uniquely identify each record
for your internal use. Most of the time, the AutoNumber values will be
monotonically increasing, but that is not guaranteed... numbers may be
skipped for various reasons and groups of numbers may be skipped. Thus, if
you have users who will expect a monotonically increasing sequence of
numbers, don't rely on AutoNumber (in fact, the general recommendation is
that you use them for joins and relationships in your database and never
display them to the user).

If you need a user-viewable number, you'll need to write VBA code to create
that number according to your needs.

Larry Linson
Microsoft Access MVP
 
Back
Top