Macro to set the "Default view" on "Continuous -or- Single Form"

J

jmslab

Hoi,

On a form I want to create 2 buttons. One with the macro which set the
default view of the form on "Continuous Form" and the other which set
it on "Single Form".
Can somebody help me out.

regards,
Johan
 
F

fredg

Hoi,

On a form I want to create 2 buttons. One with the macro which set the
default view of the form on "Continuous Form" and the other which set
it on "Single Form".
Can somebody help me out.

regards,
Johan

Here's some code.
All you need is one command button, not two.

DoCmd.Echo False
DoCmd.OpenForm "frmContinuous", acDesign, , , , acHidden
If Forms!frmContinuous.DefaultView = 0 Then
Forms!frmContinuous.DefaultView = 1
Else
Forms!frmContinuous.DefaultView = 0
End If
DoCmd.Close acForm, "frmContinuous", acSaveYes
DoCmd.OpenForm "frmContinuous"
DoCmd.Echo True

Change frmContinuous to whatever the actual name of your form is.
 
J

jmslab

Thanks a lot for your quick respons,

This works only when you have MsAccess with the designmode on your
computer.
When other people only have view and data-edit mode this will not
work.
It's also that I want this button on the form itself and not on the
screen before you open this form.

If I understood you answer,.... this all isn''t possible ??

regards,
Johan
 

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