Son of a gun. I never realized there wasn't a property that let you know
what the current view was!
When you open the form in DatasheetView, you have the option of opening it
in ReadOnly by setting the datamode parameter to acFormReadOnly:
DoCmd.OpenForm formname[, view][, filtername][, wherecondition][,
datamode][, windowmode][, openargs]

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I have set the DefaultView to form view and I have added a button so that
> when I click on it, it opens the form in DatasheetView. This is still not
[quoted text clipped - 32 lines]
>> >> >
>> >> > Thanks.
Mya48 - 29 Mar 2005 23:25 GMT
This is what I entered in the code window:
Private Sub Form_ViewChange(ByVal Reason As Long)
DoCmd.OpenForm "frmVitalSigns_Phones", [View As AcFormView =
acFormOpenDataMode], [FilterName], [WhereCondition], [DataMode As
AcFormOpenDataMode = acFormReadOnly], [WindowMode As AcWindowMode =
acWindowNormal], [OpenArgd]
End Sub
and it is still not working.
> Son of a gun. I never realized there wasn't a property that let you know
> what the current view was!
[quoted text clipped - 41 lines]
> >> >> >
> >> >> > Thanks.
Douglas J. Steele - 29 Mar 2005 23:59 GMT
You don't need (nor want) the square brackets in your call: what I pasted
was from the Help file, where the square brackets indicate that the
parameter is optional.
Assuming you actually have values defined for variables named FilterName,
WhereCondition and OpenArgd, try:
DoCmd.OpenForm "frmVitalSigns_Phones", acFormOpenDataMode, FilterName,
WhereCondition, acFormReadOnly, acWindowNormal, OpenArgd
Somehow, though, I suspect that you're not using a Filter and a Where
clause...

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> This is what I entered in the code window:
>
[quoted text clipped - 63 lines]
>> >> >> >
>> >> >> > Thanks.