Setting the datasheet view to view only.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I set the Datasheet view of a form to read only? I want other users to be
able to look at the datasheet view but not enter any data using this view. Is
this possible? What would I need to enter in the code?

Thanks.
 
Set the form's AllowAdditions, AllowEdits and AllowDeletions properties to
False.
 
I see what you are saying but if I do this, I won't be able to edit, add or
delete in form view. I only want the users to be able to do all of this in
form view but not in datasheet view. Any other suggestions?

Thanks.
 
Set the form's DefaultView to only allow form view, and add a button that
they can click on. When they click on it, change the view to datasheet and
set the form properties.
 
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
doing what I need because I can edit, delete and add. Can you show me an
example of what the code should look like? When you said add a button they
can click on, what did you want the button to do?

Thanks.
 
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]
 
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.

Douglas J. Steele said:
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]


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Mya48 said:
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
doing what I need because I can edit, delete and add. Can you show me an
example of what the code should look like? When you said add a button they
can click on, what did you want the button to do?

Thanks.
 
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...

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Mya48 said:
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.

Douglas J. Steele said:
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]


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Mya48 said:
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
doing what I need because I can edit, delete and add. Can you show me
an
example of what the code should look like? When you said add a button
they
can click on, what did you want the button to do?

Thanks.

:

Set the form's DefaultView to only allow form view, and add a button
that
they can click on. When they click on it, change the view to datasheet
and
set the form properties.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I see what you are saying but if I do this, I won't be able to edit,
add
or
delete in form view. I only want the users to be able to do all of
this
in
form view but not in datasheet view. Any other suggestions?

Thanks.

:

Set the form's AllowAdditions, AllowEdits and AllowDeletions
properties
to
False.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Can I set the Datasheet view of a form to read only? I want other
users
to
be
able to look at the datasheet view but not enter any data using
this
view.
Is
this possible? What would I need to enter in the code?

Thanks.
 
Back
Top