Results 1 to 8 of 8

Thread: Hidong controls

  1. #1
    Join Date
    Mar 2010
    Posts
    41

    Unanswered: Hidong controls

    hi there,

    i have a data entry form to hold details of people of work for me part time and full time

    on the form i have 2 fields

    part time hours
    full time hours

    1 employee obviously work either full or part time

    i want to hide the part time control for full time employees and hide the full time controls for part time employees

    how would i do that?

  2. #2
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Is the database on a shared drive? Because you did not include this information, it can't be assumed that you don't have a single computer shared by employees.

    If you are using a shared drive, I would recommend finding code that identifies the user's id name, and set up a table of of all the userids with an access code for 1) View Full Time Hours, 2) View Part Time Hours, 3) View Both. I have used code that is available free on the internet which identifies the user's id, called basRegistry.

    In the form Open event, identify the user id name, search your ID Names table, or whatever you choose to name it, for the name and make the control or controls visible that apply to the user's access rights.
    Last edited by JerryDal; 04-21-10 at 11:37. Reason: grammar

  3. #3
    Join Date
    Mar 2010
    Posts
    41
    Sorry i dont think i was clear, its not a shared drive...

    basically i have an empoye form, the 2 fields i am looking at are:

    Part Time Hours: 16 hours
    Full time Hours: (blank)

    So my form has 2 fields but for each employee only 1 field will have data in it. As the example above full time hours field does not have data in it therefore i want it hidden...

    and vice versa

    how would i do that, what code would i need in the procedure?

  4. #4
    Join Date
    Mar 2010
    Posts
    41
    can anyone help?

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Like this:
    Code:
    Private Sub Form_Current()
    
        If IsNull(Me.Amount_1.Value) Then
            Me!Amount_1.Visible = False
        Else
            Me!Amount_1.Visible = True
        End If
        If IsNull(Me.Amount_2.Value) Then
            Me!Amount_2.Visible = False
        Else
            Me!Amount_2.Visible = True
        End If
    
    End Sub
    If the fields I test for Null in my example do not allow Null values, replace IsNull(Field...) by Field... = 0.
    A more universal solution would consist in using:
    Code:
        If Nz(IsNull(Me.Amount_1.Value), 0) = 0 Then
    But it all depends on how the fields are designed in the table (Data type, allow Null or not, default value, etc.).
    Have a nice day!

  6. #6
    Join Date
    Mar 2010
    Posts
    41
    Thankyou so much Sinndho your a star i love you!! ive been working on it all day and not got anywhere but youv ehelped me a lot!!

  7. #7
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Hey calm down ! You're welcome, but anyway it was not that hard.
    Have a nice day!

  8. #8
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Redsky, I am not sure if this post went off of another track, but I have spent enough time on this to earn a submission. Your problem posed a question in my mind: "is there a way to secure Access information in a non-shared environment?" Common sense tells me "no". Anybody with a thumb drive can take the database home, or perhaps email it to themselves from work, and then get through the security measures at their leisure.
    I have just built a small database with a "Main" form that displays a picklist of users names, and then prompts for a password. It is not at all secure, but it does show that you can restrict the user's view depending on the access rights. If you unhide all the hidden objects you can see the workings of the application.
    The password for ADMIN1 is "snickers". Once you log on as ADMIN1, you can see all the employees' passwords. I am only presenting this as a way to answer what I thought was a question about database security. It has been tested briefly.

    If I understood the problem correctly, Redsky, you can never be sure about hiding data from view in your standalone PC environment.
    Jerry
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •