Link to home
Start Free TrialLog in
Avatar of Farmgirl
Farmgirl

asked on

How to change Access form view with VBA?

Is there a way to change a form's view form single to continuous with VBA Code?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

me thinks, you will need two forms , one single and one continuous, open accordingly.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For reference, here is the code: it closes Form1 if needed, changes the default view in design mode, closes and reopens it.

(°v°)
If SysCmd(acSysCmdGetObjectState, acForm, "Form1") Then _
    DoCmd.Close acForm, "Form1"
DoCmd.OpenForm "Form1", acDesign
Forms("Form1").DefaultView = 1   ' continuous
DoCmd.Close acForm, "Form1", acSaveYes 
DoCmd.OpenForm "Form1"

Open in new window

Avatar of Farmgirl
Farmgirl

ASKER

These answers Informed me that I couldn't do what I wanted so I found a workaround through other coding on the form.   I didn't think through want I wanted to do so the coding wasn't apparent at first.