PDA

View Full Version : Solved: toggle subform views



eed
12-01-2005, 01:52 PM
Hi, all,

Is there a command I could attach to a button to toggle a subform between Continuous Form view and Datasheet view?

I had briefly thought I could just set the CurrentView property, but this is read-only; duh, me. Closing and reopening the entire main form so that I can change the subform in design view is not really an option in this case.

If I can't just toggle the view while the subform is open, I guess I can have two subforms based on the same recordset, one in each view, and the button could actually toggle the source of the subform...? http://vbaexpress.com/forum/images/smilies/think.gif

Any ideas welcomed with appreciation,
eed

eed
12-01-2005, 02:07 PM
Okay, well, I had that second idea about toggling the SourceObject as I was writing my post. It worked well enough for my purposes.


The button just checks the current SourceObject, swaps it to the opposite, and changes the button caption so that it's relevant to which view you're in (i.e., in datasheet view, button says "View form for typing," and in form view, button says "View datasheet for pasting").

So even without toggling the view itself, I've got it solved. Sorry I bothered everyone with the thread!

~ eed