Form doesn't open in datasheet view in switchboard

giedrius

Registered User.
Local time
Today, 10:32
Joined
Dec 14, 2003
Messages
80
Hello,

I have a form in A2K which is set to be displayed in datasheet view (both DefaultView, ViewsAllowed are set to Datasheet). When I open it straight away, it is displayed in datasheet view as required. However if I open it from the switchboard - it opens in single form view. What could I be doing wrong here?

Thanks for any tips.

giedrius
 
Hi, I had the same problem before, I don't know what causes it, but to bypass it, instead of making a command button that opens a form, make a macro that opens the form and a command button that opens the macro. In the macro you can define what view the form should open in. :)
 
I have noticed that many people dismiss the built in MS Access Switchboard as old hat. However I find it a very quick and easy way of getting my databases up and running, and with a few tricks you can do marvelous things with this free utility.

Your particular problem has a very simple solution, and the basic principle of this solution will allow you to do some fancy things with the switchboard.

Create a new module give it a name something like: "basSwitchboardControl"

Add the following subroutine and replace the "FormName" "frmNumberDone" with your form name:

Public Sub fFrmOpenAsDataSheet()

Dim FormName As String

FormName = "frmNumberDone"

DoCmd.OpenForm FormName, acFormDS
With Forms(FormName)
'.fAddItems 'This will run a function on your form
'.lblIntro.Visible = False ' you can hide controls or show them!
End With

End Sub

Open the switchboard manager, then the "Edit Switchboard box" enter some suitable text like "Open Form X as Datasheet" in the command combo box choose "run code" and in the box underneath type the name of your function in the module above. (One annoying limitation of the switchboard manager is that you cannot cut and paste, however to overcome this limitation I usually enter "xxxxxxx" in the "code name" box and then I close the switchboard manager, then open the module where the function is I want to run, then copy its name, then open the switchboard table, find the "xxxxxxx" entry and replace it with the function name I have copied)

In the section of the code that starts "With" (I usually refer to this section as the " with events" section) you will see the items below. These items referred directly to your forms properties, these are only examples from my own form you will have to change the names to reflect the names of the controls on your form.

.fAddItems 'This will run a function on your form
.lblIntro.Visible = False

As you can see, it is quite easy for you to control any of your forms controls from the switchboard via a sub/function.
 
You could also drag your datasheet form onto an unbound form and open the new form instead.
 
Thanks folks for quick responses. Everything works just fine. That was great help.

thanks,
giedrius
 
I was about to submit the same question and found this on a search.

Very useful. Thanks
 

Users who are viewing this thread

Back
Top Bottom