'Locking' records entered via a form

G

Guest

Hello,

We have a database that opens an 'initial' form on database open and stays
open while our data entry enter data into subsequent forms in a series by
hitting a 'Next' Command Button. We have the following code behind that
button that goes to the initial form ('fScrEligCriteria' in code below),
gathers the values from four header fields, and places those values in the
same four header fields that are present on the next form in the series (see
below):

Private Sub Form_Current()
Call SetAutoValues(Me)
End Sub

Private Sub Next_Click()
On Error GoTo Err_Next_Click
Call OpenNextForm(Me.Name)
Exit_Next_Click:
Exit Sub
Err_Next_Click:
DoCmd.Close acForm, Me.Name
Resume Exit_Next_Click
End Sub

Sub OpenNextForm(strName As String)
Dim intOrder As Integer, frmName As String
On Error GoTo OpenNextForm_Err
intOrder = DLookup("[FormOrder]", "LU_Forms", "[FormName]= '" & strName
& "'")
frmName = DLookup("[FormName]", "LU_Forms", "[FormOrder]= " & intOrder
+ 1)
If Not IsNull(frmName) Then
DoCmd.OpenForm frmName, , , , acAdd
End If
DoCmd.Close acForm, strName
OpenNextForm_Err:
'MsgBox Err.Description
Resume Next
End Sub

The code works great, but we have discovered a potential issue. If you have
the initial form ('fScrEligCriteria') open, and you go back to the main
database window and double-click open any form and advance thru the records
already created using that Form by clicking the Form Record Navigator button,
it will over-write the info. on the four header fields w/ the values present
in the open 'fScrEligCriteria' form record. This is outside of normal
workflow, and the data entry person should never have to go thru these steps,
but is there a way to 'lock down' records that have already been entered?
What we're thinking is to have a 'Finished' button at the bottom of the form
that would essentially save and lock-down this record so that these header
fields could not get over-written by setting off the 'SetAuto'Values' code
noted above by opening the given form while having the initial
'fScrEligCriteria' form open at the same time. Also, we haven't completely
set Primary Keys in each table of the database. Would that help prevent this
from happening? I'm still interested in any suggestions for reducing user
error and protecting already-existing records.

Thank you.
 
G

Guest

SORRY! I received an error saying there was a problem posting this message
and to try again. You'll notice essentially the same post a couple entries
down for today's posts. Thought I had to re-do my post, but I guess not.
Will appreciate all replies to whichever post is clearer! Thank you!
 

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

Top