CodeGunnerLev1 wrote:
Good day guys...
I must say this forum is quite of useful one. I really appreciate what
you guys are doing and I hope it will continue on.
I have few questions that needs some help.
1. I want to know how do you create a primary key that increment
itself but with a specified format. Say s3075711 something like that.
I doesn't have to be like that but similar to it. And for distributed
database, is it possible to say, give a certain range of unique
primary key to a person and another range of primary keys to another
person? (Just to not make it overcomplex, just answer the first one..)
Is is really necessary to make that field the primary key? You could
use an autonumber (always visible = false) and have another that is your
calculated key.
You would not want to use an autonumber field. Since it uses alphas, it
would need to be text.
I would create a table. Maybe call it TableKeys. In it have a field
called KeyNum. Init the field with some value. When you open the form,
you would 1) Get the current value, 2) store that value to a variable 3)
Increment the number, 4) update the TableKeys field with the new value,
then add whatever additional stuff you need to make it unique (like
adding the S).
Autonumbers, tho sequential in nature, may have breaks in them. This
can be caused by starting to add a record than aborting the add for example.
So you need to consider when you want to create the key. Perhaps when
the record is saved...in the form's BeforeUpdate event. That way you
can keep the record numbers sequential. Or you can create it when you
go to a new record. Then if you abort the add, check the tablekeys
table to see if the number is the same and decrement it.
I think if you want to give keys to others, you should do either one or
the other...sequent ial numbers for all or sequential numbers for users.
You don't want to be doing two sets of code.
You will need a method to get the user name/ID. See
http://www.mvps.org/access and check the API's for getting user name.
Or get the username if you have Access security set on.
If you give sequential numbers to users, you need a method to add a user
and his sequential number set.
Overall, I would use an autonumber field and make this calced key an
indexed field. A key is a key is a key. You can "prettify" the key for
them for presentation but use the autonumber as the real key.
2. How do you design Access so that it can be used as a distributed
database? I have a group that is expanding in size (non-profit), and
it require more than one data populator to populate the database.
What do you mean by "distribute d database"? Are the people on the same
network? Or is the app located at multiple locations but all share the
same data? Are you talking about a replicated database? I don't know
what a data populator is.
>
Thank you again for all your help. And if you can give me a reference
with which I can find the answers to my questions, I would be very
thankful.
The help file is a start.
Next...
http://groups.google.com/advanced_search?q=&
In the Groups text box enter *access*
Then enter what words you want to search for.
http://www.mvps.org/access
Some access programmers have taken the time to put together some Access
tips to help. Here's two of them.
http://www.granite.ab.ca/accsmstr.htm http://allenbrowne.com/tips.html
Kind Regards
Erwin K