User name and ID

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

Guest

I have a database that 10 users can log to it ,I have a form in this db that
includes the fields "user name" and "ID" ,is there a way to make the system
captures the current user name and ID in the fields "USER NAME" ,"ID" once
the user open the form in add mode?
 
If you wish to have this data on hand for use during their session, you can
hide the form when they login and then refer to it in your VBA or SQL code.

Regards,
Nick
 
I don't understand you,but it seems that i was not clear,i don't want to hide
it for them,all that i need only that the database writes the user name and
ID automatically when the user adds a new record ,instead that they whrite
this information every time he adds a record .
 
If you are using user level security, then you can use the CurrentUser()
function to grab the Access username.
 
I think we are an the same wave length. Here's what I do.

User table:
UserID PK Autonumber
Username Text

User logins in by selecting their name from the User list (Form with
Combobox (SELECT User.UserID, User.Username FROM User) Column 1 bound). When
the user selects their name and clicks "Login" button on form, the form is
hidden but remains accessible for VBA & SQL purposes. (On Click Event
(Me.Form.Visible = No))

In all my other tables that I wish to record the user against a transaction,
I have a UserID column. When a user does any transaction I record their
details by either;

A hidden textbox on a form with the default set to (=Forms!Login!cbouserid)
Or
SQL Update or Append where the criteria is set to (=Forms!Login!cbouserid)
Or
In VBA using (usr = Forms!Login!cbouserid) Of course you need to (Dim usr As
String) in the VBA code first.

Does this make sense?

Regards,
Nick.
 
Back
Top