Opening form for viewing only

  • Thread starter Thread starter Names
  • Start date Start date
N

Names

Hi,

How does one prevent a form from being changed? I am trying to have the form
open for confirmation purposes, but opening in print preview mode is not
quite what I have in mind.

I tried using a macro, setting the data mode argument to "Read only", but
when I open the supposedly "Read only" form, I am still able to change the
information stored in the fields. I also tried setting "Allow edits", in the
property sheet of the form, to "no". However, the same problem occured and
information in the opened form could still be changed. But setting "Allow
additions" to "no" works (in preventing addtional entries). What should I do?

Thanks in advance!
 
I have tried AllowEdits - No, using Access 2003 and is OK with me. What type
of form are you using and what ver. of Access?

Ο χÏήστης "Names" έγγÏαψε:
 
Thanks for the reply. I'm using Access 2003. The form is quite an ordinary
form. It is based on a query that filters records according to
ClassificationID, so that when a user clicks on a button in the subform of
the main data entry form, the relevant form is opened, with only the records
under that classification.

I am trying to make it such that the information in this second form that
opens cannot be changed by the user, but I have not had much success on this,
and have only managed to prevent the adding of new records, using Allow
Additions - no.

Thanks so much for your time!
 
Have you tried Locking the fields?


Names said:
Thanks for the reply. I'm using Access 2003. The form is quite an ordinary
form. It is based on a query that filters records according to
ClassificationID, so that when a user clicks on a button in the subform of
the main data entry form, the relevant form is opened, with only the
records
under that classification.

I am trying to make it such that the information in this second form that
opens cannot be changed by the user, but I have not had much success on
this,
and have only managed to prevent the adding of new records, using Allow
Additions - no.

Thanks so much for your time!
 
Great! I hadn't tried locking the fields, thanks a lot for the advice. It's
working now, after a quick search in the Help for "Lock fields" after reading
the posts, and discovering it was under properties, for the textbox controls
of the relevant fields..

Thank you!
 
Thanks for helping,

I typed in the following code, because I'm also trying to get different
forms to open depending on what is entered in another field (Category).

Private Sub MainformRunOpenCatForm_Click()
DoCmd.OpenForm
"=[Forms]![MainFormName]![SubformName]![FieldName].[Value]", , , ,
acFormReadOnly
End Sub

I was still able to type into the form that opened, and could change the
data there. So I tried what you had suggested:

Private Sub MainformRunOpenCatForm_Click()
DoCmd.OpenForm "FormName", , , , acFormReadOnly
End Sub

But like what happened above, changes could be made to the data.. This Read
only method does seem suitable, though. Because it seems that if I lock the
fields I might need to have a separate form for editting entries as opening
the form (elsewhere) in edit mode through a macro does not seem to override
having locked the fields. Is this true? I tried to get the locked form to
open in edit mode but the fields remained locked.

Thanks for all the help.
Regards
 
Thanks.. Sorry I don't know much about code. Somehow both versions seem to be
doing the same thing so far; I've changed it according to your suggestion.
Here is the exact code I have used:

Private Sub MainformRunOpenCatForm_Click()
FormToOpen = Forms![Mainform]![Subform3]![Category].[Value]
DoCmd.OpenForm FormToOpen, , , , acFormReadOnly
End Sub

When the form opens, still the entries can be changed, the Read only part
doesn't seem to be working. I'm quite puzzled.

Thanks again for your time!

Linq Adams via AccessMonster.com said:
Private Sub MainformRunOpenCatForm_Click()
DoCmd.OpenForm
"=[Forms]![MainFormName]![SubformName]![FieldName].[Value]", , , ,
acFormReadOnly
End Sub

makes no sense at all!

"=[Forms]![MainFormName]![SubformName]![FieldName].[Value]"

is not a valid value! To use a textbox value as the file name to open, you
need to do something like

Private Sub MainformRunOpenCatForm_Click()

FormToOpen =Forms![MainFormName]![SubformName]![FieldName].[Value]

DoCmd.OpenForm FormToOpen , , , , acFormReadOnly

End Sub

assuming that

Forms![MainFormName]![SubformName]![FieldName].[Value]

is the correct sytax to refer to the textbox on the subform. I'm not at a PC
that has Access installed right now, and deldom use subforms, so I can't be
sure that the syntax is correct, but try it.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Hi Jeff,

Is it possible to override the setting of locking fields? For e.g. having a
macro which would open the form in edit mode is supposed to override the
setting of "Allow Edits = No". I tried this method to override the locking of
fields but to no avail..
 
Hi all,

I accidentally found that when I don't use a certain macro on the form, it
can be opened "read-only". This particular macro is a "set value" macro that
is attached to the "on current" event of the form. I have been using it to
set the value of a certain field whenever the form opens, but when it is
supposed to be "read-only", I actually don't need it as only existing records
would be viewed. So in case anyone is facing a similar problem this might be
why.

Thanks for all the help!
Regards.
 
Back
Top