Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use VBA to switch view in Split Form

386 views
Skip to first unread message

Matthew Pfluger

unread,
Jul 28, 2009, 12:24:01 PM7/28/09
to
I have a split form set to display the datasheet on bottom. I have a
CommandButton in the Form Header that I want to perform the following
commands:

1. Set Focus to the datasheet portion of the Split Form
2. Select all records
3. Copy to the clipboard

Everything works except setting focus to the datasheet portion. I've tried
SetFocus on a bound control, but that doesn't work. I've tried the
CurrentView property of the Form, but it is ReadOnly (contrary to what the
Help File says...).

Does anyone know how to accomplish this? Thanks.
Matthew Pfluger

bhicks11 via AccessMonster.com

unread,
Jul 28, 2009, 12:33:16 PM7/28/09
to
Could you show the code you tried please.

Bonnie
http://www.dataplus-svc.com

--
Message posted via http://www.accessmonster.com

Matthew Pfluger

unread,
Jul 28, 2009, 12:44:01 PM7/28/09
to
I've tried the following:
Me.CurrentView = 2 ' Doesn't work, Read-Only property
Docmd.RunCommand acCmdSubformDatasheet
Docmd.RunCommand acCmdSubformDatasheetView
Docmd.RunCommand acCmdDatasheetView

None of the RunCommands work either. They all give the error message that
the "Command is not available now."

I need to set focus to the Datasheet view programatically, but it seems that
there is no key combination or property to do this.

Matthew Pfluger

bhicks11 via AccessMonster.com

unread,
Jul 28, 2009, 2:27:48 PM7/28/09
to
Have you tried:

me!subformname.form.setfocus

Bonnie
http://www.dataplus-svc.com

Matthew Pfluger wrote:
>I've tried the following:
>Me.CurrentView = 2 ' Doesn't work, Read-Only property
>Docmd.RunCommand acCmdSubformDatasheet
>Docmd.RunCommand acCmdSubformDatasheetView
>Docmd.RunCommand acCmdDatasheetView
>
>None of the RunCommands work either. They all give the error message that
>the "Command is not available now."
>
>I need to set focus to the Datasheet view programatically, but it seems that
>there is no key combination or property to do this.
>
>Matthew Pfluger
>

>> Could you show the code you tried please.
>>
>> Bonnie
>> http://www.dataplus-svc.com

--

Matthew Pfluger

unread,
Jul 28, 2009, 4:37:01 PM7/28/09
to
The datasheet is not a subform. It is the Datasheet in Split Form view, so
the code below does not work. Thank you for your answer, however.

Matthew Pfluger

Steve Sanford

unread,
Jul 29, 2009, 12:35:01 AM7/29/09
to
I have A2K and A2K3 and this is the first time I have heard of "Datasheet in
Split Form view". This might come in handy for a MDB I am working on.

What version of Access are you using?

Would you describe how you create a "Datasheet in Split Form view"? I can't
find anything in Help (surprise!).

Thanks
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

John W. Vinson

unread,
Jul 29, 2009, 2:16:52 AM7/29/09
to
On Tue, 28 Jul 2009 21:35:01 -0700, Steve Sanford <limbim53 at yahoo dot com>
wrote:

>Would you describe how you create a "Datasheet in Split Form view"? I can't
>find anything in Help (surprise!).

Split Forms are a new feature in Access 2007.
--

John W. Vinson [MVP]

Steve Sanford

unread,
Jul 29, 2009, 4:36:01 AM7/29/09
to
Thanks John.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

0 new messages