synchronizing forms for same record and table

  • Thread starter Thread starter clayton ledford
  • Start date Start date
C

clayton ledford

I'm kind-of new with acces, so forgive me: Hopefully this is simple. I have
two forms. Form-A is set up with "allow edits" to be off, and "allow
additions" on. That way users cannot change old records by mistake, but they
can view them.

I need to add a way that a user can choose to update the old records with
some controls.

I have a button on Form-A that opens Form-B to perform an update. The forms
are nearly identical, but Form B allows edits. How do i get Form-B to
automatically show the record they were viewing in Form-A?

My goal is to lock the primary key and only let them update the other
attributes. It will close when they click a "save" command.
 
Apologies are not necessary, but I would offer a couple of comments.

Whenever possible, use one form. There really is no need to to have two
forms. You can change the Allow Edits and most other properties of a form
using VBA. Get rid of Form B. Why have to maintain the same thing twice.
Just add an Edit Record button to your form and in the click event all you
need is:
note, this also prevents the modification of the primary key control

With Me
.AllowEdits = True
.txtPrimeKey.Enabled = False
End With

Then in the Form After Update event turn it back off
With Me
.AllowEdits = False
.txtPrimeKey.Enabled = True
End With
 
Back
Top