Results 1 to 5 of 5
  1. #1
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107

    Manage User Access

    I have used the following code to find the current username and I would like to use a AutoExec macro to compare the username to the tblUser table and if the username does not exist then open the signup form for them to register themselves.



    Public Function UserName()
    UserName = CreateObject("wscript.network").UserName
    End Function

    Does anyone have a suggestion on how to do this?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    assuming your tbUser is storing the name returned from your function then something like

    Code:
    if dcount("*","tblUser","dbUserName='" & UserName & "'")=0 then 'user not registered
        docmd.openform "frmSignUp"
    else
        docmd.openform "frmMain"
    end if

  3. #3
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    Works great thank you!

    How would I open the form in add new record mode?

    Public Function NewUser()


    If DCount("*", "tblObjectUser", "UserName='" & UserName & "'") = 0 Then 'user not registered
    DoCmd.OpenForm "frmNewUser"
    Else
    DoCmd.OpenForm "frmOrderStatus"
    End If
    End Function

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    google 'DoCmd.OpenForm' for all the information you need about that command

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    sparker
    Google with these search criteria to identify a series of relevant youtube videos.
    youtube steve bishop managing user access


    Good luck

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

Similar Threads

  1. Replies: 7
    Last Post: 11-24-2015, 12:42 PM
  2. Replies: 13
    Last Post: 11-18-2013, 02:20 PM
  3. How to manage the manage the input of data?
    By Gambit17 in forum Import/Export Data
    Replies: 4
    Last Post: 07-30-2013, 10:32 AM
  4. Manage Access 2003 ULS thru SQL or Code
    By evander in forum Security
    Replies: 3
    Last Post: 01-27-2012, 06:37 PM
  5. Manage attachments
    By accessnewb in forum Programming
    Replies: 6
    Last Post: 08-19-2011, 11:52 AM

Tags for this Thread

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