seeing what belongs to you only!

J

JOM

I have created a database that employees enter there daily productivity,
currently they are able to view other people's productivity and I dont want
that ...can someone please help me....
 
R

Rick B

Modify the query upon which your forms and reports are based on. Under the
"userid" field put something like...

=CurrentUser()

Assuming you are using User-Level Security, and assuming the record stores
the same userid they used to log into the database, this will allow only
their records to display.
 
J

JOM

The form(employee) that am working on is based on a table(tblemployee) that
has employee information, it also has a subform.. The form also has a
combobox that an employee can select there names and enter productivity. The
following filter is on the main form [EmplID] =
[Forms]![tblemployee]![cmbSrchEmpl] and I put the same code on the open form
as an event procedure. This way when the form is opened, its blank and you
cannot see anything apart from the unbound comboboxso when one selects
his/her name, then you are able to view the subform!

so anyway how will I use the =current user() when my form is based on a
table and not a query?

Thanks for you help!
 
R

Rick B

If they can only select their userid from that combo box, then it makes no
sense to have it.

Get rid of the combo box and go into the source for your form. Click the
Elipse to open the query builder and put the

=CurrentUser()

Under the user id so that only their records are displayed.


--
Rick B



JOM said:
The form(employee) that am working on is based on a table(tblemployee) that
has employee information, it also has a subform.. The form also has a
combobox that an employee can select there names and enter productivity. The
following filter is on the main form [EmplID] =
[Forms]![tblemployee]![cmbSrchEmpl] and I put the same code on the open form
as an event procedure. This way when the form is opened, its blank and you
cannot see anything apart from the unbound comboboxso when one selects
his/her name, then you are able to view the subform!

so anyway how will I use the =current user() when my form is based on a
table and not a query?

Thanks for you help!



Rick B said:
Modify the query upon which your forms and reports are based on. Under the
"userid" field put something like...

=CurrentUser()

Assuming you are using User-Level Security, and assuming the record stores
the same userid they used to log into the database, this will allow only
their records to display.
 
J

JOM

Thanks Rick this workedperfect for me!

Rick B said:
If they can only select their userid from that combo box, then it makes no
sense to have it.

Get rid of the combo box and go into the source for your form. Click the
Elipse to open the query builder and put the

=CurrentUser()

Under the user id so that only their records are displayed.


--
Rick B



JOM said:
The form(employee) that am working on is based on a table(tblemployee) that
has employee information, it also has a subform.. The form also has a
combobox that an employee can select there names and enter productivity. The
following filter is on the main form [EmplID] =
[Forms]![tblemployee]![cmbSrchEmpl] and I put the same code on the open form
as an event procedure. This way when the form is opened, its blank and you
cannot see anything apart from the unbound comboboxso when one selects
his/her name, then you are able to view the subform!

so anyway how will I use the =current user() when my form is based on a
table and not a query?

Thanks for you help!



Rick B said:
Modify the query upon which your forms and reports are based on. Under the
"userid" field put something like...

=CurrentUser()

Assuming you are using User-Level Security, and assuming the record stores
the same userid they used to log into the database, this will allow only
their records to display.

--
Rick B



I have created a database that employees enter there daily productivity,
currently they are able to view other people's productivity and I dont
want
that ...can someone please help me....
 
J

JOM

The =currentuser() worked on Friday I thought, but today, went to let people
test it, and it backfired on me... my form is now based on the following
query SELECT employee.* FROM employee WHERE
(((employee.UserID)=CurrentUser())); but the query is not even pulling my
name as am logged in.
tbl employee contains employee information including userID which Is their
LAN login---- I manually input this in the table, is there something am
missing or why is it not pulling anyone name?

OJ!


Rick B said:
If they can only select their userid from that combo box, then it makes no
sense to have it.

Get rid of the combo box and go into the source for your form. Click the
Elipse to open the query builder and put the

=CurrentUser()

Under the user id so that only their records are displayed.


--
Rick B



JOM said:
The form(employee) that am working on is based on a table(tblemployee) that
has employee information, it also has a subform.. The form also has a
combobox that an employee can select there names and enter productivity. The
following filter is on the main form [EmplID] =
[Forms]![tblemployee]![cmbSrchEmpl] and I put the same code on the open form
as an event procedure. This way when the form is opened, its blank and you
cannot see anything apart from the unbound comboboxso when one selects
his/her name, then you are able to view the subform!

so anyway how will I use the =current user() when my form is based on a
table and not a query?

Thanks for you help!



Rick B said:
Modify the query upon which your forms and reports are based on. Under the
"userid" field put something like...

=CurrentUser()

Assuming you are using User-Level Security, and assuming the record stores
the same userid they used to log into the database, this will allow only
their records to display.

--
Rick B



I have created a database that employees enter there daily productivity,
currently they are able to view other people's productivity and I dont
want
that ...can someone please help me....
 
R

Rick B

Did you miss the line in my original post, "Assuming you are using
User-Level Security"?

CurrentUser() pulls the ACCESS login name, not the network login name.

There are functions out there that will let you capture the network login.
Do a search and you should find them.


--
Rick B



JOM said:
The =currentuser() worked on Friday I thought, but today, went to let people
test it, and it backfired on me... my form is now based on the following
query SELECT employee.* FROM employee WHERE
(((employee.UserID)=CurrentUser())); but the query is not even pulling my
name as am logged in.
tbl employee contains employee information including userID which Is their
LAN login---- I manually input this in the table, is there something am
missing or why is it not pulling anyone name?

OJ!


Rick B said:
If they can only select their userid from that combo box, then it makes no
sense to have it.

Get rid of the combo box and go into the source for your form. Click the
Elipse to open the query builder and put the

=CurrentUser()

Under the user id so that only their records are displayed.


--
Rick B



JOM said:
The form(employee) that am working on is based on a table(tblemployee) that
has employee information, it also has a subform.. The form also has a
combobox that an employee can select there names and enter
productivity.
The
following filter is on the main form [EmplID] =
[Forms]![tblemployee]![cmbSrchEmpl] and I put the same code on the
open
form
as an event procedure. This way when the form is opened, its blank
and
you
cannot see anything apart from the unbound comboboxso when one selects
his/her name, then you are able to view the subform!

so anyway how will I use the =current user() when my form is based on a
table and not a query?

Thanks for you help!



:

Modify the query upon which your forms and reports are based on.
Under
the
"userid" field put something like...

=CurrentUser()

Assuming you are using User-Level Security, and assuming the record stores
the same userid they used to log into the database, this will allow only
their records to display.

--
Rick B



I have created a database that employees enter there daily productivity,
currently they are able to view other people's productivity and I dont
want
that ...can someone please help me....
 
L

Larry Linson

Rick B said:
There are functions out there that
will let you capture the network login.
Do a search and you should find them.

There's one at http://www.mvps.org/access/api/api0008.htm.

On the other hand, if a user ever has to run a copy of the database
off-site, at home, that won't work. In that case, it would have been better
to apply security and have the employee take both the .MDB or .MDE and the
..MDW files.

If it is an Access client to a server database on the network, though,
running off-site isn't (usually) an issue.

Larry Linson
Microsoft Access MVP

Larry Linson
Microsoft Access MVP
 
Top