Locking Previous Records in Add Mode in Continuous Item Form

pitt_ph

Registered User.
Local time
Yesterday, 23:17
Joined
Sep 7, 2012
Messages
37
Hey all,

In Access 2007 I have a couple of continuous item forms that can be opened from either an "Add Data" or an "Edit Data" switchboard using either a "Add Entry" or a "Edit Entry" button. (I created these switchboards myself, by using a blank form and buttons leading to different forms.)

In the former case, when the continuous item form is open in the "Add Data" mode, I'd like to ensure that if a person is doing data entry for a particular form, once they write a record and press "enter" (or "tab") to get to a new record in the same form, all the previous records "lock" so the individual cannot edit them while they're in "add data" mode. Incidentally, I wouldn't want this previous record locking operation to be done on a form in "Edit Data" mode.

The reason why I'd like this fix to be done is that I've noticed that every time an individual tries to click on a previous record while in "add data" mode, the form automatically shifts to "edit data" mode, which can lead to a few problems with form/record continuity in the long run.

Any ideas on what to do here? I've done a couple of Google searches, and I've even considered the solution of conditional formatting, but I don't know how that'd work out.

Thank you in advance!
 
Due to the way in which Continuous Forms operate, if you lock one record you lock all records.

One way to do what you want is to lock your records on the sub form and use a pop up form that allows the user to add new records.
 
Let me rephrase what John said.
In a form (continuous or otherwise) only a single record is the current record and only the current record can be modified. As soon as you move focus to a different row, that record becomes the current record.

It is only the current record that you need to worry about since no other record can ever be updated.

So, to handle your requirement, you need code in the form's Current event to determine if the form is in "Add" mode and if it is to lock the record if it is not the NewRecord.

Code:
If Me.NewRecord Then
    Me.AllowEdits = True
Else
    If Me.Addmode = True Then
        Me.AllowEdits = False
    Else
        Me.AllowEdits = True
    End If
End If
 

Users who are viewing this thread

Back
Top Bottom