I have created a file that has database-level security. I have everything setup via forms. No user has access to the tables. I want to take the security one step further and don’t know if I can. I want to, upon launching a form this lets users updated their hours, limit the records that the user can view to their own. Can this be done using the existing security system?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Allowing limited access to records via a form (Access 97)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Allowing limited access to records via a form (Access 97)
- This topic has 8 replies, 4 voices, and was last updated 22 years, 2 months ago.
AuthorTopicWScchambers@work
AskWoody LoungerJanuary 21, 2003 at 5:44 pm #382143Viewing 0 reply threadsAuthorReplies-
WSDouglas Martin
AskWoody LoungerJanuary 21, 2003 at 7:30 pm #646836It’s a lot easier if you have set up workgroup security (since you can just use currentuser() to get the current user). If by database-level security you mean that all you have done is set a database password, then it’s a little harder (currentuser() will always be “Admin”). If you are using Windows NT or 2000 (might work in XP – I’ve never tried), see http://www.mvps.org/access/api/api0008.htm%5B/url%5D to get the id you logged into NT or 2000 with.
Now, when user creates a record, you’ll need to store the id as part of the record. You can then base the form on a query that only shows records with that id.
-
WScchambers@work
AskWoody Lounger -
WScharlotte
AskWoody LoungerJanuary 22, 2003 at 1:18 pm #646967If the users are logging in with uniquer usernames, it’s easiest to set their permissions up by group and then check to see whether the user is in a particular group allowed to do a particular thing. You have to do the checking from the Admins level. Here’s some code from the NeatCd97.mdb, downloadable from Microsoft:
Function CurrentUserInGroup(GName As String) As Integer ' ' Checks if the current user is in the specified group ' Uses a secure workgroup, so it will run for non-privileged users ' Dim w As Workspace, U As user, i As Integer CurrentUserInGroup = False ' 2nd argument is Admins level user name, 3rd is password Set w = DBEngine.CreateWorkspace("", "Admin", "") Set U = w.Users(CurrentUser()) For i = 0 To U.Groups.Count - 1 If U.Groups(i).Name = GName Then CurrentUserInGroup = True Exit Function End If Next i End Function
-
WBell
AskWoody_MVPJanuary 22, 2003 at 2:40 pm #646982As an alternative to the function Charlotte provided, you could also simply create a form that has a query as it’s data source, and specify the CurrentUser() function as the criteria for the field containing the UserID. Note that you will either need to set that field default to CurrentUser(), or you will need to default it on the form that you do data entry of new records.
-
WScchambers@work
AskWoody LoungerFebruary 3, 2003 at 4:34 pm #650069I am banging my head on this one. Can’t I just use the “On Apply Filter” function built into the form? I have been trying it unsuccessfully, of course. I am trying what seems logical to me: =[Form]![Name]=CurrentUser(), where [Name] is the main field on the form. The user selects their name from a pull down list to update their information for the day. I am just saying that I want the form to not show any records where the name on the record is not the name of the current user. Why can’t I get this?????
-
WSDouglas Martin
AskWoody LoungerFebruary 3, 2003 at 6:46 pm #650090I’m puzzled why you would be using the On Apply Filter event. If you really want to do it with filters, why not just set the Filter directly? However, from the point of view of maintaining the code, I’d agree with WendellB that simply doing your check in the query behind the form would be simplest. No need for the user to select their name; all they would see would be their own records.
If you really want to have your security tight, I’d look into Run With Owner Permission queries as well.
-
WScchambers@work
AskWoody LoungerFebruary 3, 2003 at 7:55 pm #650111 -
WSDouglas Martin
AskWoody LoungerFebruary 3, 2003 at 9:05 pm #650140Have a query as the recordsource of your form (i.e. the first property when you show all properties of the form). It can either be a distinct query that you’ve created separately (so the the name of the query shows up as the recordsource of the form) or it can just be a query “behind” the form (so that when you look at the form’s properties the recordsource starts with SELECT …).
Make sure your query contains all the fields you want your form to be able to display or change, including the field that contains the userid (you must have a field that stores the userid since that is the only way you can “remember” the userid).
As the criterion for the userid field, type currentuser() . That will ensure that the query can only find records where the stored userid matches the current user’s id. You can check your work so far by running the query (click the exclamation mark icon) to see that only the current user’s records are being displayed.
Now, you also need to store the current user’s id when a new record is created. If you only care about who created the record, by far the simplest solution is to put currentuser() as the Default Value property of the field in the table definition (note that that will affect new records only; if you created your Userid field in a non-empty table, you’ll need to manually fix the existing records).
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Thunderbird in trouble. Here comes Thundermail
by
Alex5723
15 minutes ago -
Get back ” Open With” in context menus
by
CWBillow
40 minutes ago -
Many AMD Ryzen 9800X3D on ASRock have died
by
Alex5723
4 hours, 27 minutes ago -
simple general stupid question
by
WSaltamirano
1 hour, 49 minutes ago -
Automatic Toggle code for pages and bookmarks for Table of Content (Awaiting moderation)
by
switchtolinux
8 hours, 49 minutes ago -
April 2025 Office non-Security updates
by
PKCano
33 minutes ago -
Microsoft wants to hear from you
by
Will Fastie
16 hours, 41 minutes ago -
Windows 11 Insider Preview Build 22635.5160 (23H2) released to BETA
by
joep517
19 hours, 2 minutes ago -
Europe Seeks Alternatives to U.S. Cloud Providers
by
Alex5723
1 day ago -
Test post
by
Susan Bradley
1 day, 2 hours ago -
Used Systems to delete Temp files Gone WRONG what does this mean?
by
Deo
1 day, 4 hours ago -
SSD shuts down on its own
by
CWBillow
19 hours, 52 minutes ago -
OneDrive File Sharing Changes
by
David Clark
1 day, 12 hours ago -
OneDrive File Sharing Changes
by
David Clark
1 day, 14 hours ago -
Win 10 Pro 22H2 to Win 11 Pro 23H2 Conversion Guide
by
doneager
14 hours, 38 minutes ago -
Today is world backup day
by
Alex5723
1 day, 6 hours ago -
Windows .exe on Mint
by
Slowpoke47
1 day, 16 hours ago -
Reviewing your licensing options
by
Susan Bradley
1 day, 1 hour ago -
Apple has been analyzing your photos since September 2024
by
B. Livingston
11 hours, 25 minutes ago -
What Windows 11 24H2 offers beyond bugs
by
Lance Whitney
7 hours, 16 minutes ago -
Making sense of Settings in Windows 11
by
Simon Bisson
8 hours, 36 minutes ago -
Windows 11 pro fails to log in after upgrading Win 10 pro to Win 11 pro 24h2
by
ben_sitaud
1 day, 12 hours ago -
23H2 / 24H2 / Local v. Microsoft Account.
by
CWBillow
1 day, 10 hours ago -
YouTube Ad Blocker Blocker
by
bbearren
1 day, 10 hours ago -
Obscure historical facts about Windows
by
Cybertooth
1 day, 12 hours ago -
Microsoft Backup
by
Linda2019
1 day, 3 hours ago -
What is the best notepad++ version for W7?
by
Picky
1 day, 11 hours ago -
What are right steps to move MS 365 Office+OneDrive files from PC to iMac?
by
glnz
2 days, 20 hours ago -
How to move existing MS 365 Office with OneDrive files from PC to new iMac
by
glnz
2 days, 20 hours ago -
How to move MS 365 files (some on OneDrive) from PC to iMac
by
glnz
3 days, 15 hours ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.