Read Only

  • Thread starter Thread starter Emma
  • Start date Start date
E

Emma

Hi I have a form that I would like the user to enter data then have that data
be read only the next time you open up the form. Is this possible, if so how?

Thanks Emma
 
Hi Emma
the way I have done this in the past is to make the form always read only
and then whenever anyone wants to enter make a button for them to click on to
edit which enables the form to be entered into. Place a button on the form,
go into properties of that button and next to 'on click' use event procedure
and then enter the following code in the VBA window.

Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True

I hope this works and helps.
 
well, if you want to *display* existing records and never allow them to be
edited, yet allow new records to be added - just open the form in Design
view, and set the AllowAdditions property to Yes, the AllowEdits property to
No, and the DataEntry property to No. here's the problem, though: the new
record will only be editable *while the user is entering it*. if the user
moves off of the new record before completing it - either by moving to
another record or closing the form - s/he cannot go back and finish it,
because it is no longer a "new" record.

a better solution might be set up a mainform bound to the table, with
RecordsetType property set to Snapshot. then add an unlinked subform, bound
to the same table, with the DataEntry property set to Yes. in the subform,
the user will not see pre-existing records, but s/he can add new records AND
move between those new records without losing the ability to edit them *as
long as the form is open*. when the form is closed, then next time it is
opened, the subform is again blank and waiting for new records to be
entered.

if you want the mainform records to show in Datasheet view, or Continuous
Forms view, rather than Single Form view, then use an unbound mainform to
hold *two* subforms - one bound to the table with RecordsetType set to
Snapshot, and the other also bound to the table but with the DataEntry
property set to Yes, so it will function as described above.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top