How do you automaticaly add the user name to the record

G

Guest

I am trying to develope a database in access 2003 which can log who entered
specific notes into the notes table, can any one help on how this can be doen
autopmaticaly
 
S

storrboy

I am trying to develope a database in access 2003 which can log who entered
specific notes into the notes table, can any one help on how this can be doen
autopmaticaly


Nothing is automatic. You have to create a log-in form (or use Access
security), capture the login and write it to whevere it needs to be
written using queries and likely code. There have been numerous posts
about it in this group and comp.databases.ms-access that you can
search for and read. I beleive there are also topics on it at
www.mvps.org/access as well as number of contributors that have links
there. Start by doing as much reading as you can then look for answers
to specific problems, issues and questions.
 
B

BruceM

One way would be to have the After Update event for the text box bound to
the Notes field contain something like:
Me.NoteWriter = CurrentUser()
where NoteWriter is the text field in which the user who who wrote the note
is recorded. You may need to do something to lock the control after the
note has been added, or the CurrentUser will become the last person who
edited the information. Logging in as a particular user, as mentioned in
another reply, is what will make this work. Implementing User Level
Security is one way. Search for that term and you should get all sorts of
links and other information. This page contains links to several helpful
sources:
http://www.jmwild.com/Accesssecurity.htm
 
G

Guest

Assumming that you're in an enviroment where users log into a network, you
can grab their login ID using the following example:

API: Get Login name
http://www.mvps.org/access/api/api0008.htm

Depending on how exactly you want it to work, you can call that function in
the BeforeInsert or BeforeUpdate event on the form level.

For example, if you have a field named "AddedBy" on your form, you can do
something like:

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.AddedBy = fOSUserName
End Sub

Hope that helps!

David
 
J

John W. Vinson

One way would be to have the After Update event for the text box bound to
the Notes field contain something like:
Me.NoteWriter = CurrentUser()

This may not give the desired results unless the database is secured using
workgroup security and all users log on with their own name; by default this
will pick up the username Admin.

John W. Vinson [MVP]
 
B

BruceM

I should have provided a link to information about user-level security.
Actually, if you had asked me I would have said that I did so. Maybe that
was another posting.
 

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

Top