If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Setting control properties via code
I want to turn the visible property of a control button on or off depending
on who's logged in (ie. Administrator, Salesperson etc). I think I would enter the code to run when that form is opened but I'm having trouble with how to write the code. -- TIA |
#2
|
|||
|
|||
Setting control properties via code
Use the form's Load event to run code similar to this:
Private Sub Form_Load() ' you can use a function to get the user name -- not sure how you're doing that ' in your specific situation, so I've just put a "text string" ' ("WhatTheUserNameIs") here for now Select Case "WhatTheUserNameIs" Case "Administrator" Me.CommandButtonName.Visible = True Case "Salesperson", "Clerical" Me.CommandButtonName.Visible = False Case Else Me.CommandButtonName.Visible = False End Select End Sub -- Ken Snell MS ACCESS MVP "tsison7" wrote in message ... I want to turn the visible property of a control button on or off depending on who's logged in (ie. Administrator, Salesperson etc). I think I would enter the code to run when that form is opened but I'm having trouble with how to write the code. -- TIA |
Thread Tools | |
Display Modes | |
|
|