473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Please help me with limiting user view

I've developed a database that will be used by my team (25 people)
The database is based on the Resource Planner template

The database will reside on a shared drive.
What I'd to do now is create some sort of entry point into the
database that only shows the users records they own.

So I was thinking when the database opens the user selects their name.
Then the switchboard opens but no matter what they select from the
switchboard only records that have the same name as the name selected
at open will be displayed.

I don't need any sort of password protect

How should I do this?

Thanks
Steve J
Oct 24 '08 #1
2 1452
On Oct 24, 12:22*pm, Steve <dafella...@yahoo.comwrote:
I've developed a database that will be used by my team (25 people)
The database is based on the Resource Planner template

The database will reside on a shared drive.
What I'd to do now is create some sort of entry point into the
database that only shows the users records they own.

So I was thinking when the database opens the user selects their name.
Then the switchboard opens but no matter what they select from the
switchboard only records that have the same name as the name selected
at open will be displayed.

I don't need any sort of password protect

How should I do this?

Thanks
Steve J
create a table called tblUser
userId autonumber pk
userName
userLogin
create a module called mNtuser, to get their windows login containing,
this

Option Compare Database
Option Explicit

Declare Function GetUserName& Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long)

Public Function ntUserName() As String
Dim s$, cnt&, dl&, sz&

cnt& = 255
s$ = String$(255, vbNullChar)
dl& = GetUserName(s$, cnt&)
If (Asc(Mid$(s$, cnt&, 1)) = 0) Then
cnt& = cnt& - 1
End If

ntUserName = UCase(Left$(s$, cnt&))
End Function
public function userId as long
userId = nz(dlookup("userId","tblUser","userLogin = '" &
ntusername() & "'"),-1)
end function
use = userId() in all your queries as a condition on the userId field
to return all records belonging to that user
Oct 24 '08 #2
On Oct 24, 1:49*pm, Roger <lesperan...@natpro.comwrote:
On Oct 24, 12:22*pm, Steve <dafella...@yahoo.comwrote:


I've developed a database that will be used by my team (25 people)
The database is based on the Resource Planner template
The database will reside on a shared drive.
What I'd to do now is create some sort of entry point into the
database that only shows the users records they own.
So I was thinking when the database opens the user selects their name.
Then the switchboard opens but no matter what they select from the
switchboard only records that have the same name as the name selected
at open will be displayed.
I don't need any sort of password protect
How should I do this?
Thanks
Steve J

create a table called tblUser
* * userId * autonumber pk
* * userName
* * userLogin

create a module called mNtuser, to get their windows login containing,
this

Option Compare Database
Option Explicit

Declare Function GetUserName& Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long)

Public Function ntUserName() As String
* * Dim s$, cnt&, dl&, sz&

* * cnt& = 255
* * s$ = String$(255, vbNullChar)
* * dl& = GetUserName(s$, cnt&)
* * If (Asc(Mid$(s$, cnt&, 1)) = 0) Then
* * * * cnt& = cnt& - 1
* * End If

* * ntUserName = UCase(Left$(s$, cnt&))
End Function

public function getUserId as long
* *userId = nz(dlookup("userId","tblUser","userLogin = '" *&
ntusername() & "'"),-1)
end function

use = userId() in all your queries as a condition on the userId field
to return all records belonging to that user- Hide quoted text -

- Show quoted text -
Steve
in response to your email, I'll post here so others can participate

The tbluser has the person's name and windows login (ntlogin)

If you don't know their windows login, you need to use ms-access
workgroup security, or have no security

Just having users select their name from a list is not a good idea,
cause I can choose your name, and see your records

since I don't have your table layout, I don't know how you identify
who records belong to who, I'm assuming it's an ID of some sort...
that ID and userId in tblUser is the same

the function ntUserName() gets your windows login
the function getUserId (I've renamed it from just 'userId') translates
the windows login to an ID that can be used to select records

so if your table is called tblResource with
resourceId autonumber pk
userId
resource

your query would be
SELECT * FROM tblResource WHERE userId = userId()

if I'm logged in, this will show my resources
and if you're logged in, yours
hope this helps
Oct 24 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where...
5
by: randyelliott | last post by:
Good Day, I have a MS Access (Access 2000 now upgraded to 2003) database that tracks customer information. One function of this database is to create an encrypted license file for our software,...
17
by: kimimaro | last post by:
How do you limits employee display where you enter the department for all the employee within that department be displayed and if lets say they are 100 or so and you have to limits 10 employee per...
118
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely...
1
by: Griff | last post by:
Hi I'm not sure of the best way to go about achieving my goal and would appreciate any advice. What I would like to do is to generate a control that can be dropped onto a web page. For...
1
by: Technical | last post by:
Hi, I'm currently working on a webproject with ASP.NET 2.0, Visual Studio 2005, and SQL Server 2005 that allows users to search for and view images. My problems is that I need a way to limit...
3
by: Bob Alston | last post by:
What do others do to limit the number of characters a user can enter in a text box? Do you specify the number of characters exactly so that only that number will fit in the text box, thereby...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
4
WyvsEyeView
by: WyvsEyeView | last post by:
I have a datasheet form in which one field is a combo box that will potentially contain hundreds of records. I've read about several methods of speeding up such combo boxes or limiting their initial...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.