Windows UserID and Access

G

Guest

Is there a way for a database to pull the user ID from the PC when some one
opens it?

What i have is a form to track when my reps login and out for their shift
and i want to see if people are logging in for other people when they are
actually not there. Everyone has a unique ID they log into the network with
and i would like to capture that and record who was logged into that coumpter
when they left that record.

Thanks
 
G

Guest

I have limited knowldge of this type of stuff so i have another question.
How do i use this so when they access a form, it will use this code to grab
the user ID and add it to the table record? Thanks
 
G

Guest

I was not able to get that to work but here is what i was able to do.

I created a new module added the code you directed me to and named it
fOSUserName.

Then in the form i added a text box and under the control source i added
=[fOSUserName].

When i open the form, it grabs the user id but when i go to save the record,
that is not saved anywhere. How do i take that information i pull and save
it in the table?
 
D

Douglas J. Steele

Rename the module. Modules cannot have the same name as functions or subs
contained within them.

Also, use =fOsUserName() as the Control Source, rather than what you have.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


GregH. said:
I was not able to get that to work but here is what i was able to do.

I created a new module added the code you directed me to and named it
fOSUserName.

Then in the form i added a text box and under the control source i added
=[fOSUserName].

When i open the form, it grabs the user id but when i go to save the
record,
that is not saved anywhere. How do i take that information i pull and
save
it in the table?

Douglas J. Steele said:
Easiest place would be in the form's BeforeInsert event.
 
G

Guest

so i loaded the code and saved it as module1. I went back to the form and
changed the control source to =fOSUserName(). When i open the form, my user
ID is displayed along with a memo text box. I enter reanom information in
the text box and save the record but when i look back at the table the user
ID is not there but the information i entered into the memo text box is
there. Could there be a problem linking the field in the form with the
table? From my point of view it seems like there is no way for the field in
the folr to match up with the table it was credted from. If it would help, i
can send you an example of what im working on so you can see it. I really
appreciate all the help.

Douglas J. Steele said:
Rename the module. Modules cannot have the same name as functions or subs
contained within them.

Also, use =fOsUserName() as the Control Source, rather than what you have.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


GregH. said:
I was not able to get that to work but here is what i was able to do.

I created a new module added the code you directed me to and named it
fOSUserName.

Then in the form i added a text box and under the control source i added
=[fOSUserName].

When i open the form, it grabs the user id but when i go to save the
record,
that is not saved anywhere. How do i take that information i pull and
save
it in the table?

Douglas J. Steele said:
Easiest place would be in the form's BeforeInsert event.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have limited knowldge of this type of stuff so i have another
question.
How do i use this so when they access a form, it will use this code to
grab
the user ID and add it to the table record? Thanks

:

Check http://www.mvps.org/access/api/api0008.htm at "The Access Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Is there a way for a database to pull the user ID from the PC when
some
one
opens it?

What i have is a form to track when my reps login and out for their
shift
and i want to see if people are logging in for other people when
they
are
actually not there. Everyone has a unique ID they log into the
network
with
and i would like to capture that and record who was logged into that
coumpter
when they left that record.

Thanks
 
D

Douglas J. Steele

Unless the control source is a field in the underlying recordset, whatever
is in the text box isn't going to get saved.

Your options are to use VBA code to populate the text box, or, assuming that
you don't want the User Id to change for records that have already been
saved, set the text box's Default Value to the function.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


GregH. said:
so i loaded the code and saved it as module1. I went back to the form and
changed the control source to =fOSUserName(). When i open the form, my
user
ID is displayed along with a memo text box. I enter reanom information in
the text box and save the record but when i look back at the table the
user
ID is not there but the information i entered into the memo text box is
there. Could there be a problem linking the field in the form with the
table? From my point of view it seems like there is no way for the field
in
the folr to match up with the table it was credted from. If it would
help, i
can send you an example of what im working on so you can see it. I really
appreciate all the help.

Douglas J. Steele said:
Rename the module. Modules cannot have the same name as functions or subs
contained within them.

Also, use =fOsUserName() as the Control Source, rather than what you
have.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


GregH. said:
I was not able to get that to work but here is what i was able to do.

I created a new module added the code you directed me to and named it
fOSUserName.

Then in the form i added a text box and under the control source i
added
=[fOSUserName].

When i open the form, it grabs the user id but when i go to save the
record,
that is not saved anywhere. How do i take that information i pull and
save
it in the table?

:

Easiest place would be in the form's BeforeInsert event.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have limited knowldge of this type of stuff so i have another
question.
How do i use this so when they access a form, it will use this code
to
grab
the user ID and add it to the table record? Thanks

:

Check http://www.mvps.org/access/api/api0008.htm at "The Access
Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Is there a way for a database to pull the user ID from the PC
when
some
one
opens it?

What i have is a form to track when my reps login and out for
their
shift
and i want to see if people are logging in for other people when
they
are
actually not there. Everyone has a unique ID they log into the
network
with
and i would like to capture that and record who was logged into
that
coumpter
when they left that record.

Thanks
 
G

Guest

Thanks so much. The default value is exactly what i needed.

Douglas J. Steele said:
Unless the control source is a field in the underlying recordset, whatever
is in the text box isn't going to get saved.

Your options are to use VBA code to populate the text box, or, assuming that
you don't want the User Id to change for records that have already been
saved, set the text box's Default Value to the function.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


GregH. said:
so i loaded the code and saved it as module1. I went back to the form and
changed the control source to =fOSUserName(). When i open the form, my
user
ID is displayed along with a memo text box. I enter reanom information in
the text box and save the record but when i look back at the table the
user
ID is not there but the information i entered into the memo text box is
there. Could there be a problem linking the field in the form with the
table? From my point of view it seems like there is no way for the field
in
the folr to match up with the table it was credted from. If it would
help, i
can send you an example of what im working on so you can see it. I really
appreciate all the help.

Douglas J. Steele said:
Rename the module. Modules cannot have the same name as functions or subs
contained within them.

Also, use =fOsUserName() as the Control Source, rather than what you
have.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I was not able to get that to work but here is what i was able to do.

I created a new module added the code you directed me to and named it
fOSUserName.

Then in the form i added a text box and under the control source i
added
=[fOSUserName].

When i open the form, it grabs the user id but when i go to save the
record,
that is not saved anywhere. How do i take that information i pull and
save
it in the table?

:

Easiest place would be in the form's BeforeInsert event.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have limited knowldge of this type of stuff so i have another
question.
How do i use this so when they access a form, it will use this code
to
grab
the user ID and add it to the table record? Thanks

:

Check http://www.mvps.org/access/api/api0008.htm at "The Access
Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Is there a way for a database to pull the user ID from the PC
when
some
one
opens it?

What i have is a form to track when my reps login and out for
their
shift
and i want to see if people are logging in for other people when
they
are
actually not there. Everyone has a unique ID they log into the
network
with
and i would like to capture that and record who was logged into
that
coumpter
when they left that record.

Thanks
 

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