Enabling and disabling controls on switchboard form

First question is how do I create a switchboard without usingt the wizard ? if I have a switchboard and how do I disable buttons based
on users workgroup?
llegaspiAsked:
Who is Participating?
 
Steve BinkConnect With a Mentor Commented:
Select Case of DBEngine.Workspaces(0).UserName
   Case "User1": MyControl1.Enabled = False: MyControl2.Enabled = True
   Case "User2": MyControl1.Enabled = True: MyControl2.Enabled = False
   Case Else:
       ' Whatever else you need...
End Select
0
 
PlamodoCommented:
You can create a form and use it as a switchboard.  Then on that form, you can enable and disable buttons with :

cmdGo.enabled = true
cmdGo.enabled = false

0
 
Steve BinkConnect With a Mentor Commented:
Do it the way I learned it!  Make a switchboard with the wizard, then go through and dissect the code.  All the wizard is create one table (Switchboard Items) and one form (Switchboard).  Open up the table in datasheet view, the form in design view, and trace the code in your head to see what it does.  It really is a pretty decent setup, and completely customizable if you want to change it around.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
llegaspiAuthor Commented:
But how do I disable buttons based on user's login
0
 
llegaspiAuthor Commented:
Routinet,

Where do I put this code? i have no clue.

Thanks,
Lourdes
0
 
Steve BinkConnect With a Mentor Commented:
The most likely place for that particular code would be the OnLoad event for the form.  

I cannot stress enough the value of dissecting the code generated by the switchboard wizard.  It can be a great tutorial for altering forms on the fly, as well as opening recordsets and dealing with them.  You don't need very strong skills in VB; you can trace through the switchboard code and use the Object Browser to look up any methods or properties you don't understand.
0
 
PlamodoCommented:
To get to the OnLoad event for the form, open the form in design mode... move your mouse to the box in the upperleft corner of the window and right-click ... select 'Build Event' and choose "code builder" .. this will automatically place you in the OnLoad event of the form.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.