By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,450 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,450 IT Pros & Developers. It's quick & easy.

Key based on Login entry

P: n/a
I'm trying to create a database that has the following features but
don't know the best way to go about it.

1. When a user opens the database, I'd like that user to enter a 3
letter code to identify the user.

2. That 3 letter code would then be used as the first 3 characters in
the primary key field.

ie. User ID is FSJ. Any record created would then have the primary key
as FSJ***.

The reason for this is I'd like to have a database on the server which
holds all the records. Then when several users takes that database on
the road (ie. laptop), records they create would all have different
primary keys and through replication, these new records could be added
to the database on the server.

TIA

Dec 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
francophone77 wrote:
I'm trying to create a database that has the following features but
don't know the best way to go about it.

1. When a user opens the database, I'd like that user to enter a 3
letter code to identify the user.

2. That 3 letter code would then be used as the first 3 characters in
the primary key field.

ie. User ID is FSJ. Any record created would then have the primary key
as FSJ***.

The reason for this is I'd like to have a database on the server which
holds all the records. Then when several users takes that database on
the road (ie. laptop), records they create would all have different
primary keys and through replication, these new records could be added
to the database on the server.

TIA

If you have security applied to your app, you can use CurrentUser().

You could have a field in the employee file called LoginName. This
field stores the value of the login name. Then when a person logs in,
you can get the info you want from the employee file....like your 3
letter code. You might be better of storing the EmpID instead.

Anyway, that's the approach I'd take. If you want to take your
approach, perhaps call up a form or InputBox() to get the 3 chars and
call that in your main form or an autoexec macro.


Dec 17 '05 #2

P: n/a
On 17 Dec 2005 14:39:49 -0800, "francophone77"
<fr***********@hotmail.com> wrote:
I'm trying to create a database that has the following features but
don't know the best way to go about it.

1. When a user opens the database, I'd like that user to enter a 3
letter code to identify the user.

2. That 3 letter code would then be used as the first 3 characters in
the primary key field.

ie. User ID is FSJ. Any record created would then have the primary key
as FSJ***.

The reason for this is I'd like to have a database on the server which
holds all the records. Then when several users takes that database on
the road (ie. laptop), records they create would all have different
primary keys and through replication, these new records could be added
to the database on the server.


For your scheme to work, you need to be dealing simply with adding
records. Are you sure you aren't going to have any of the
disconnected users EDITING any of the existing information? If so,
then a replication scheme based solely on adding records will not
function very well.

But, for now, let's assume that all you want to do is ensure that
newly created information finds its way to the main database.

Primary keys (actually, any key, whether primary or not) can be a
combination of fields. I'm presuming that you are thinking that the
initials of which you speak will be prepended to an autonumber field.
There is no need to prepend them. Just define your primary key as the
combination of the autonumber field and a field that you use for
storing the initials of the record creator.

The only issue left is what happens if there end up being two records
with the same number in the field that you are using for your
autonumber. In a word: nothing. Just make sure that the autonumber
field isn't itself an indexed field requiring unique values and Access
will allow you to append the data from your satellite databases
without a problem.

mike
Dec 18 '05 #3

P: n/a
.... to follow on from salads suggestion.

I would strongly reccomend against including the user identification in a
field with other data as the primary key. It is much easier to store it in
a field on it's own, this makes filtering and sorting by this data much
easier and you can always concatenate it to other data if necessary in order
to display it.

--
Terry Kreft

"salad" <oi*@vinegar.com> wrote in message
news:NF*****************@newsread1.news.pas.earthl ink.net...
francophone77 wrote:
I'm trying to create a database that has the following features but
don't know the best way to go about it.

1. When a user opens the database, I'd like that user to enter a 3
letter code to identify the user.

2. That 3 letter code would then be used as the first 3 characters in
the primary key field.

ie. User ID is FSJ. Any record created would then have the primary key
as FSJ***.

The reason for this is I'd like to have a database on the server which
holds all the records. Then when several users takes that database on
the road (ie. laptop), records they create would all have different
primary keys and through replication, these new records could be added
to the database on the server.

TIA

If you have security applied to your app, you can use CurrentUser().

You could have a field in the employee file called LoginName. This field
stores the value of the login name. Then when a person logs in, you can
get the info you want from the employee file....like your 3 letter code.
You might be better of storing the EmpID instead.

Anyway, that's the approach I'd take. If you want to take your approach,
perhaps call up a form or InputBox() to get the 3 chars and call that in
your main form or an autoexec macro.

Dec 18 '05 #4

P: n/a
Thanks for the suggestions. The information in the main database will
not be edited, I just need a way to include data entered while users
are on the road with a replication of the main database. I'm going to
try utilizing 2 primary keys as suggested using the initials plus the
autonumber. thanks for your suggestions

Dec 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.