use vba to open form in split view

dbar15

New member
Local time
Today, 06:13
Joined
Jan 7, 2012
Messages
2
Hi,
I am enjoying my first Access programming project and have found many answers to my questions on this forum. I'm not finding an answer to my latest problem, so I ask for your help.

I have a table that users can edit in a form. This one form is opened either as a continuous form (DoCmd.OpenForm strEditForm) or as a datasheet (DoCmd.OpenForm strEditForm, acFormDS).

To give my users multiple options, I want to open the same form a third way (split form), without creating a new form. (Note that I will have 20 tables plus a form for each table, so I don't want to create multiple forms for each table if I can avoid it.)

I cannot find a way to set the "Default View" option programmatically. The AcFormView Enumeration list doesn't show split form.

I found references to manipulating properties like this:
Forms!FormName.SplitFormOrientation = acDatasheetOnBottom.
This works, but only if the form is already set in Properties to "Split Form" before run time.

The approach I'm trying to take goes like this:
--DoCmd.OpenForm "EditForm", acDesign, , , , acHidden
--SET DEFAULT VIEW TO SPLIT FORM
--Forms!EditForm.SplitFormOrientation = acDatasheetOnBottom
--other settings...
--DoCmd.OpenForm "EditForm", acNormal, , , , acWindowNormal
-- User does some editing
-- When closing form, don't save it as split form (i.e., keep the default view as continuous form) or save as split form and convert back to continuous when user opens regular form view.

Is this possible or do I need to revert to some other method?

Thanks for your help.

Doug
 
Have your tried

Code:
[forms]![YourFormName].defaultview=1

I don't know what number represents what view, but trial and error should tell you. Also, you won't be able to do this with a runtime version.
 
Don't.

Split forms have by themselves not entirely consistent behaviour, eg if you want to edit stuff and escape from it, depending on whether you are in the datasheet part or form part. If you make this available as a choice purportedly similar to continuous form or datasheet, you get into trouble with consistency, that you simply cannot maintain in any shape or form.

Even letting users change between datasheet and continuous yields plenty of confusion, since you have no header/footer on a datasheet, and hence no closing button nor anything else. And you cannot copy or pase paste whole records
into/from a continuous form, as you can with datasheet.

All in all - you just create potential for pitfalls, confusion for users, and support issues.
 
Thanks for the replys.

speakers -- that worked for me. I see what you mean about it not working at runtime.

spikepl -- thanks for the advice. I'll avoid the split form for this app.
 

Users who are viewing this thread

Back
Top Bottom