Access 2007 Switchboard - hide buttons?

RiotSloth

New member
Local time
Today, 15:17
Joined
Mar 14, 2013
Messages
9
Hi Guys

I hope this is the right forum to post this. I am using Access 2007, so have the Switchboard where the buttons are stored in a table. I want to hide buttons depending on the security level of the user.

I have the security level as a TempVar, but for the life of me I cannot figure out how to get the switchboard to hide menu buttons for certain levels.

E.G.

If [TempVars]![SecLevel] <3 then me.switchboard.itemNumber(4).visible=false

obviously that doesn't work though.

Can anyone please help?! I have been tearing my hair out, and searching fruitlessly for about an hour now! :)

many thanks

RiotSloth
 
assuming an A2007 is very much like an A2003 switchboard, then use the FillOptions event.

The code first empties all the menu options for the current menu page, and then fills the ones that have an item in the switchboard items table. Just test the option, and just skip the code that sets the optionlabel. etc as appropriate.

Note you HAVE to have an active option1 in a standard switchboard, or it will not function correctly.
 
Many thanks, Dave, but your reply leaves me none the wiser unfortunately!

All the controls for the switchboard are in a macro, what do you mean 'test the option'?

kind regards

RS
 
I use the A2003 switchboard, which has relatively easy-to-use code

Is there no code module in an A2007 switchboard?
 
A2007 switchboard uses macros to generate the switchboard from table data.
 
all I can suggest is to try converting the relevant macro to code, and then editing the code
 
wow

i just opened A2007, and created a switchboard - but i just cannot see how it works, without spending time looking at it.

i'm sure it must be realtively easy, but it beats me for the moment
 
I prefer the way the A2003 switchboard works so rather than generating new ones in A2007/A2010, I just import one from an older application. I also usually customize the code to add options and increase the number of items from 8 to at least 12.

To incorporate simple security, you can add a column to the Switchboard Items table to indicate security level. Then change the query used by the Switchboard form to add selection criteria to select items <= the user's security level. Just make sure you have a #1 item plus an exit/return for each manu page.

Once you customize the switchboard, you may not be able to use the wizard to add/remove/modify items. I find it just as easy to update the table directly in most cases.
 
actually, I do the same as Pat. (use an A2003 switchboard)

I looked at the macros for the A2007 switchboard. I could see the button click macros, but couldn't see how the form got filled from the spreadsheet items tsble. that's the bit you need to look at.
 
If you want to post something on the Sample Databases, I will be glad to test it in A2010. Using Access 2010 and will soon be evaluating A2013 Client version.

The Switchboard is one of those things I have been mindlessly upgrading since an Access 2003 (to 2007 - then 2010). Since then, the Access engine is linked to SQL Server plus a few other things. A re-evaluation is on my "to do" list.

Was searching this forum's Sample Databases and many other sites. Wanted to evaluate switchboards to determine if there is something better to use instead of saying "if it ain't broke, don't fix it". There really isn't all that much out there about switchboards. What is the top 10 do's and dont's for switchboards?

My startup / switchboard form for example runs a SP against SQL Server's system resource and records available server hard disk space.

It would be interesting to see some type of guideline / demo db just for switchboard.
 
I had a think, and got the answer

an A2003 switchboard is linked to the switchboard items table, and uses code to process the table

the A2007 uses a query

select * from switchboarditems were pageno = selectedpage

this is the bit that uses the tempvars.

check the recordsource for the form.

----
SO what you need to do is add a function. or other test to this query to decide whether or not to include each particular item.

should be relatively easy!
 
I got tired of the limitations of the Switchboard and so I started creating a new and "improved" version that uses a main form with a subform so you are not limited to 8 items per page. This is truely a work in process so please feel free to offer suggestions if you find it confusing. The app opens to frmSwitchboard. One of the items available opens a "manage switchboard" form which is what you use to build switchboards. I had one client that wanted icons on the switchboard so this version gives you that option.

I also started adding security but it is only partially done.
attachment.php
 

Attachments

Mere beginners are not worthy to gaze at this.

What great ideas! Have been searching the internet for ideas and not come across anything close to this. This should get moved over to the Sample Databases and allow others to comment.

Will look at this closer after finishing a tax / permit form deadline. Thanks!

"The income tax has made more liars out of the American people than golf has."
"It costs ten times more to govern us than it used to, and we are not governed one-tenth as good."
 
I do something similar to pat.

My general switchboard now has something like 25 items, in 3 sections of 8, with a final return to previous switchboard. Having 25 items visible at one time is a great aid to users. There are pretty well always enough commands for the current application section.

I added loads of code, to test screen resolution, locale, various security checks to prevent database copying and so on. There are various methods to determine whether different users can see items or not. I also changed the cryptic "there is an error" to be properly informative.

It also checks that the backend is correctly linked, and opens a reconnect from if not.

Looking at the A2003 switchboard, compared with the A2007 one, I much prefer the a2003 Version - especially as you can group commands into blocks more easily.

ie, you can set menu options 1,2,3 leave 4,5 blank, and then set 6,7,8, which makes the options far clearer to the user, I think.

And I agree with Pat about the switchboard manager. I find it far easier to edit the switchboard items table directly, then use the manager form. I started to mess around with doing my own, but in truth, it's just easier to edit the table.
 

Users who are viewing this thread

Back
Top Bottom