From: Barry Edmund Wright on
Hi All,

I have a subfrm on a form. When on the subfrm I can go to the Access
Menu/View/Subform and switch between form and datasheet view. How do I
do this using VBA?

I see lots of similar posts pointing to:
http://www.tkwickenden.clara.net/codeex/282.htm
but that link is no longer available.

Thanks for your assistance.

Cheers,
Barry
From: Barry Edmund Wright on
On Apr 26, 11:21 am, Barry Edmund Wright
<barry.edmund.wri...(a)witstoronto.ca> wrote:

Thanks, figured this out:
Under a button on the main form I simply put:

If Form_subfrmClients2.CurrentView = acCurViewDatasheet Then '2
Datasheet View
Me.subfrmClients2.SetFocus
DoCmd.RunCommand acCmdSubformFormView
ElseIf Form_subfrmClients2.CurrentView = acCurViewFormBrowse Then '1
Form View
Me.subfrmClients2.SetFocus
DoCmd.RunCommand acCmdSubformDatasheetView
End If

Cheers,
Barry


> Hi All,
>
> I have a subfrm on a form. When on the subfrm I can go to the Access
> Menu/View/Subform and switch between form and datasheet view. How do I
> do this using VBA?
>
> I see lots of similar posts pointing to:http://www.tkwickenden.clara.net/codeex/282.htm
> but that link is no longer available.
>
> Thanks for your assistance.
>
> Cheers,
> Barry