Switchboard doesn't open the form with the correct view

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a switchboard button that opens a form. When I open the form manually
it opens to datasheet view, which I have set up as the default and only
allowed view. When I open the form using the switchboard button, it always
opens the form in form view, showing all the record on one line. Of course, I
can switch to datasheet view, but why does it do this when I have set up the
form as datasheet-view only?
 
Hi,
make sure the switchboard command opens the form in the appropriate mode
(edit/add mode).
You might also need to specify what view to open in e.g.:

DoCmd.OpenForm "YourFormName", acFormDS

If the switchboard overwrites whatever settings are set at the form level
then create a macro or module which has the above code in it and then run
that from your switchboard item OR scrap the switchboard manager and create
your own switchboard with buttons.
HTH
Good luck
 
Yes I had tried coding it so that it had to open in datasheet view, and it
came back with an error message: "can't switch view at this time" or
something like that. I am now in the process of making my own form.
Thanks for your reply.
 
If you use the Switchboard created by Access, the inbuilt Switchboard
commands opens the Form is FormView (Add or Edit mode) but not
DatasheetView.

If you still want to use the Switchboard command button, use the Switchboard
command RunCode and write a custom UDF (with the code posted by Oliver) to
open the Form in DatasheetView
 
Alternately you can have the switchboard run a macro to open the form and in
the macro specify in which view to open the form.
 
Back
Top