Results 1 to 2 of 2
  1. #1
    ricker090 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012

    Restrict Access to Form Based on fOSUserName()

    In Access 2010, I have a UDF called fOSUsername(). I got it from here.

    I have a table called Users. It has 2 fields: Employee ID (text) & CC (Yes/No). When CC_Form loads, I want a macro to check the employee ID using fOSUsername(). The Employee ID should already be on that list and it should have a check box either checked or unchecked in the CC field. If the Employee ID has a check then grant access to CC_Form, else deny access. If the Employee ID does not exist in the Users table then it should also be denied access. If needs be, I can create a query that looks filters out only the acceptable users, but I'm not sure if it's really necessarily.

    Is this possible? Do I even need a macro to accomplish this?

    Please note that I'm new to Access. I have a lot of experience with macros in Excel, but Access is very foreign to me.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    Yes, need code, I use only VBA, not macros. Macro in Access very different from macro in Excel. A macro in Excel is really VBA code.

    Another way to get network username is: Environ("USERNAME")

    That intrinsic function entirely replaces the procedure you reference.

    This is a common topic in forum. Search forum and Google. Review:
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Restrict user to navigation form
    By Whelt in forum Access
    Replies: 3
    Last Post: 04-22-2012, 06:19 PM
  2. How to restrict users?
    By cindytan in forum Access
    Replies: 5
    Last Post: 02-08-2012, 09:40 AM
  3. Replies: 2
    Last Post: 12-22-2010, 01:46 PM
  4. Replies: 1
    Last Post: 03-13-2010, 12:32 PM
  5. Restrict form access to certain people
    By DannyBoy7783 in forum Forms
    Replies: 2
    Last Post: 06-09-2008, 06:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums