I have a Access 97 database that was built by someone else a long time ago. The main form has several command buttons that allow users to move through the database. The person that developed the system used macros to open the new forms called from the on click event of the command buttons. The command buttons are also named with spaces and no prefix to identify them as such ("open main cra form from switchboard"). This name ("open main cra form from switchboard") is also the name of the macro the command button is calling on click.
My issue is, I'm attempting to hide a command button from a user that has been known to enter invalid data. I have the following vba code running on open of the main form, but the command button is still visible.
Set rs = db.OpenRecordset("Select CDMID from tbl_AuthorizedUsers where CitrixID = '" & ID & "' or NetworkID = '" & ID & "' ")
If rs!cdmid = 10 Then
Me.open_main_cra_form_from_switchboard.Visible = False
End IF
Note the cdmid I'm currently using is my own for testing. Also, when I used the Me. function to find the command button name it adds underscores where the spaces were in the button name. I tried changing it to not include the underscores and with [] around the button name (with and without spaces) but it is still visible.
Anyone know why I can't make it invisible? I don't want to change the button names for fear it will hose up something else in this ancient, but highly utilized, system.
My issue is, I'm attempting to hide a command button from a user that has been known to enter invalid data. I have the following vba code running on open of the main form, but the command button is still visible.
Set rs = db.OpenRecordset("Select CDMID from tbl_AuthorizedUsers where CitrixID = '" & ID & "' or NetworkID = '" & ID & "' ")
If rs!cdmid = 10 Then
Me.open_main_cra_form_from_switchboard.Visible = False
End IF
Note the cdmid I'm currently using is my own for testing. Also, when I used the Me. function to find the command button name it adds underscores where the spaces were in the button name. I tried changing it to not include the underscores and with [] around the button name (with and without spaces) but it is still visible.
Anyone know why I can't make it invisible? I don't want to change the button names for fear it will hose up something else in this ancient, but highly utilized, system.