Use VBA to switch view in Split Form

M

Matthew Pfluger

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
 
M

Matthew Pfluger

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
 
M

Matthew Pfluger

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
 
S

Steve Sanford

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
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top