Re: Password Login - Auto Populate Fields
- From: "Graham Mandeno" <Graham.Mandeno@xxxxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 11:17:42 +1200
Hi Richard
You should be using the DefaultValue property of those textboxes to provide
a default value for new records.
For the date/time field, just set the DefaultValue of the textbox to:
=Now()
For the username field, I suggest you use a global variable and a function
to return it. Put the following in a standard module:
Public gsCurrentUser as String
Public Function GetCurrentUser() as String
GetCurrentUser = gsCurrentUser
End Function
Now, change your login form which asks for the username and password so that
it stores the validated username in your public variable:
gsCurrentUser = Me!txtUserName
And, getting back to your data entry form, set the DefaultValue us the
username textbox to:
=GetCurrentUser()
You could also get clever and modify your GetCurrentUser function to check
if gsCurrentUser is an empty string and, if so, open up your login form to
ask for the username and password.
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
"Richard Perry via AccessMonster.com" <forum@xxxxxxxxxxxxxxxxx> wrote in
message news:506E534285060@xxxxxxxxxxxxxxxxxxxx
> Hi
>
> I have a table of Users (5 users only) with passwords that I have given
> them
> to log in to Access. This is not high security, just data entry. They
> want
> to keep track of how many entries a user made during a day, week, month.
>
> When the user type their password to the data entry form, their name, date
> and time to auto populate the fields, which are protected and cannot be
> changed.
>
> My problem is that it works for the first record only. When they click on
> "add a new record", the next data entry record does not have their name
> and
> date stamp.
>
> --
> Message posted via http://www.accessmonster.com
.
- Follow-Ups:
- Re: Password Login - Auto Populate Fields
- From: Richard Perry via AccessMonster.com
- Re: Password Login - Auto Populate Fields
- References:
- Password Login - Auto Populate Fields
- From: Richard Perry via AccessMonster.com
- Password Login - Auto Populate Fields
- Prev by Date: Re: Need help applying SQL statement to Access2000 Query
- Next by Date: Re: WindowState of a form
- Previous by thread: Password Login - Auto Populate Fields
- Next by thread: Re: Password Login - Auto Populate Fields
- Index(es):
Relevant Pages
|