When you create the form, you have to indicate whehter it's Single Form,
Continuous Form or Datasheet. That means that the Form view can only be
either Single Form or Continuous Form.
You could use code like this
Sub OpenFormView(FormName As String, FormView As Long)
Dim frm As Form
If FormView = 0 Or FormView = 1 Or FormView = 2 Then
DoCmd.OpenForm FormName, acDesign
Set frm = Forms(FormName)
frm.DefaultView = FormView
DoCmd.Close acForm, FormName, acSaveYes
Set frm = Nothing
DoCmd.OpenForm FormName, acNormal
End If
End Sub
To open the form in Single Form view, you'd use
OpenFormView "MyFormName", 0
To open the form in Continuous Form view, you'd use
OpenFormView "MyFormName", 1
Note that this will only work if your application is properly split into a
front-end (containing the queries, forms, reports, macros and modules)
linked to a back-end, with each user having his/her own copy of the
front-end.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Do you mean Datasheet view?
DoCmd.OpenForm "NameOfForm", acFormDS
I’m talking about the same view as Properties > Default View >
Continuous Forms.
My database/form is setup to only display one record per form (in
single form view). Sometimes there are quasi duplicate records and
continuous forms is a good way to show multiple records on one screen.
alex