Switchboard Problem

Mac_Wood

Registered User.
Local time
Today, 21:38
Joined
Dec 10, 2005
Messages
65
Hi,

I have a form which because of the operators using it is in datasheet view. The datasheet view changes to justified when I open it via the Switchboard. Is there any way to change this.
 
You could try writing a routine in a code module to open your form, and then call this from the switchboard.
 
Or go behind the scenes and look at the code (or macro) that the switchboard is using to open the form and just change the arguments so that it opens in acViewDS.
 
Actually, I don't think you can do that, Bob! The switchboard is not really a form; you can't go into the code window, find the code for a given button and change it. That would be too easy; not the Micro$oft way at all! Your first idea was the right one, writing a function then calling it from the Switchboard.

The first problem is that, as Bob pointed out, a called form will only open in DataSheet View (regardless of which view is set in its Property Box) if explicitly told to do so!

DoCmd.OpenForm "YourFormName", acFormDS

The second problem is that the native Access Switchboard is very limited in how it handles tasks, which is why most people avoid them, using a custom form instead !


In the Database window got Modules

Click on New

Paste in this code, substituting the name of your form for YourFormName

Code:
Public Function OpenInDataSheetView()
  DoCmd.OpenForm "YourFormName", acFormDS
End Function
When asked to name the module, use anything except OpenInDataSheetView. This would confuse the Access gnomes.

Now goto Tools - Database Utilities - Switchboard Manager

Hit Edit

Hit Edit again

Select the Switchboard Item that is currently opening your form

Under Command select Run Code

In the Function box enter OpenInDataSheetView

Hit Ok

Hit Close

Hit Close

You should be all set now!

Linq
 
Last edited:
Thanks chaps for your assistance. I haven't tried your suggestions yet as I am writing this while eating my tea(spare arms and hands are very useful) at work, but I'll let you know how I get on:)
 
>>>the native Access Switchboard is very limited in how it handles tasks<<<

This is true, however you can go into the switchboard code and make a minor modification which then allows you to pass variables when you call code from the switchboard Interface.

There was a thread on this a while ago, and I intend doing a set of videos showing how useful the a built in switchboard is as soon as I get a minute.
 
The other thing to note about the switchboard, is that the way it is designed, it is a useful pattern that you may find helpful.

Basically the information displayed on the switchboard form is built up from data in a table, a useful thing to be able to do in some situations.
 
That's right! I helped someone a while back who had accidentally deleted the Switchboard (not one of his own design) and was frantic to get it back. A number of people assured him that it had to be recreated from scratch, as you would with any other "form." Since the Switchboard Table wasn't deleted, I had him open a new database, create a new Switchboard, then export this Switchboard "frontend" to the original db. Problem solved!
 
I followed your instructions to the letter Missinglinq. In the Visual Basic Editor if I run Sub/UserForm the function works fine and opens my form but when I try on my Switchboard I get "There was an error executing the command". Where do I go from here?
 
I too had this same problem. I tried what linq said but it returned the same error and i'm not really sure how to work with modules so to (with some luck) fix it..

I created a new macro with the openform action.

The properties were set as:
Form Name = yourformname
View = datasheet
Data Mode = edit

Everything else left as default. For the button which opens my form, instead of using the module i set it to run the macro and it seems to work fine; opening the form in the desired datasheet view.

I think this is essentially the same as what linq has done with the module, but for some reason access is happier using the macro way.

Hope this helps,
Jon.
 
I have a really easy walk-through on how to get your form to open in Datasheet view from the Switchboard form:
http://www.accessmvp.com/JConrad/accessjunkie/switchboardfaq.html#datasheet

Also, that page has a whole bunch of FAQ information about the Switchboard:
http://www.accessmvp.com/JConrad/accessjunkie/switchboardfaq.html

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
SDET - XAS Services - Microsoft Corporation

Co-author - Microsoft Office Access 2007 Inside Out
Presenter - Microsoft Access 2007 Essentials
http://www.accessmvp.com/JConrad/accessjunkie.html
Access 2007 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------
 
Hmm, well unsuprisingly with the complexity of the other answers to this problem it doesn't work. When i first tried it i can honestly say it did, but now it doesn't ...

I'm even more confused, thanks though access i'll take a look at that.

Jon.

Edit: it's really quite strange, it now functions correctly again; opening the form in acViewDS. Maybe someone can tell me why it works sometimes?
 
Last edited:
the access switchboard is quite interesting to play around with

i do loads of things in mine as standard such as

a) test screen resolution, and advise accordingly
b) changed the standard "action not available" message to provide more information - ire explicitly report that a given form name doesn't exist
c) ask whether shutdown is really intended
d) include code to reconnect the backend

you can also modify the fields IN the switchboard items table, to add extra columns, which can be useful - eg can be used to provide an easy way of showing/hiding menu items for particular users/user groups
 
Now the module works, i don't really know why it didn't in the first place but after this little problem i think my project is finished, good news, now to test it - oh dear!

Thanks for your help,
Jon.
 

Users who are viewing this thread

Back
Top Bottom