Hi.
how do I specify "Continuous Forms View" ?
One cannot use the OpenForm method to change the view to Continuous Forms
View. The only way to change it at run time is to open the form in Design
View, change the Default View Property to Continuous Forms, then open the
form again. The downside is that the user will be prompted to save changes
when the form is closed.
Private Sub OpenFormBtn_Click()
On Error GoTo ErrHandler
Dim frm As Form
Dim frmName As String
frmName = "frmMyForm"
DoCmd.OpenForm frmName, acDesign
Set frm = Forms(frmName)
frm.DefaultView = acDefViewContinuous
DoCmd.OpenForm frmName
CleanUp:
Set frm = Nothing
Exit Sub
ErrHandler:
MsgBox "Error in OpenFormBtn_Click( ) in " & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & "Error #" & _
Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp
End Sub
However, one may keep the form's default view as continuous forms, yet open
it elsewhere in VBA code with the appropriate view argument, such as
acFormDS, acFormPivotChart, or acFormPivotTable (if using a later version of
Access). So, if one opens a continuous form in Datasheet View with VBA,
there will be no prompt when the form closes:
DoCmd.OpenForm frmName, acFormDS
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
See
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.