Results 1 to 3 of 3
  1. #1
    usmcgrunt's Avatar
    usmcgrunt is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2010
    Location
    Just outside the gates of freedom
    Posts
    71

    Passing combobox value from one form to another

    I have a login form that appears when the user opens the database. The user selects his/her name from a combobox (I am using a SELECT stmt for the row source to pull userID, userName, and userAccess from a table) and then enters their password. Next they click an 'enter' button that verifies their username and password as well as their database access rights.



    While this verification is taking place I have a splash screen that pops up that shows the progress of the verification.

    What I am trying to do.

    1. Hide the login form on the same 'enter' button.
    2. Reference the username combobox on the hidden form in a text box on the visible splash screen form.
    3. Finally, use the information in the hidden form to restrict the users access to certain forms and reports. Essentially what I am looking to do here is place an IF stmt in the form or reports onOpen event that checks the users access code in the hidden frmLogin and if it is corrent THEN open the form IF NOT then display a message stating that they do not have access to this form/report.

    I am not trying to implement a security policy. I just want to limit certain forms and reports to individuals that need to access them.

    Thanks for the help.

    Sean

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Sean,

    What you are doing is actually "trying to implement a security policy."

    1) Are you getting the log on form hidden?

    Me.Visible = False

    2) you will need to add hidden text box controls on the login form that hold the User name and userAccess. I assume the the combo box is bound to the user ID.

    To get the data into this texct boxes you can pull the data from the columns of the combo box.

    For example if the uuser Acess in in column 3 of the row source of the combo box then uset the control source of a text box to be:

    =cboUser.Column(2)

    Not that the index is 2. Since the first column has an index of 0.

    to get the values from these these boxes on another forms use something like this:

    forms!frmLogOnFormName!txtuserAccessLevel

    You will need to substitute your actual form name (frmLogOnFormName) and control name (txtuserAccessLevel).

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,041
    Hi,

    in a similar case I used a table tsysCurrentUser. When the user logged on, the values in that table (user ID, user name, logon name, logon date/time, security level, ...) got overwritten with those of the current user. this table always contains just one record.
    Two advantages: you don't have to keep a hidden form open all the time so you free some resources and you can use that table to link to the source tables of your form, making the security level part of the dataset. This made enabling security easier for me.

    grNG

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

Similar Threads

  1. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  2. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  3. Replies: 1
    Last Post: 03-24-2010, 08:42 AM
  4. Passing specific Combobox info to a query
    By pwdpwd in forum Queries
    Replies: 1
    Last Post: 02-09-2010, 12:53 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 PM

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