Dissalow Update until click submit

dzirkelb

Registered User.
Local time
Today, 11:59
Joined
Jan 14, 2005
Messages
180
I have a simple data entry form...when the user enters in something and tabs to the next field, it automatically adds the data into that field. Is it possible to dissalow or turn this automatic update off? I ultimately want the user to complete the whole form, then click submit. At that point in time and only then will the data be updated into the table....(the submit button simply goes to a new record to add)

Or, same thing, when they tab down to the last field, and then tab to the first again (rolls over to new record)

thanks!
 
Update

Trys this code in the Before Update Event of the form:

Dim strMsg As String
strMsg = "Data has been changed."
strMsg = strMsg & " Save this record?"

If MsgBox(strMsg, vbYesNo, "") = vbNo Then
DoCmd.RunCommand acCmdUndo
Else
End If

In addition you can disable the Tab-, Alt- Pgup- and PgDown keys using this code in the
On Key Down event of the form:

'33 - PgUp; 34 - PgDown; 9 - Tab; 18=Alt
Select Case KeyCode
Case 33, 34, 18, 9
KeyCode = 0
Case Else
'Debug.Print KeyCode, Shift
End Select
 
that works perfect! Thanks!

This along with not allowing the form to be closed (unless I click a button to close it) works perfectly...thanks!
 
Even easier is this:

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
    If MsgBox("Save changes?", vbQuestion + vbYesNo) = vbNo Then Cancel = True
End Sub
 
I am actually now looking for something a little further with this code....Now, I have disabled the close button and have placed a command button on the form to close. Its labled (cancel and exit)...so, what i wish to do is cancel any data that has been entered in the form thus so far. The code provided works great on the before update portion; however, doesnt' work with the click function on my button...any ideas on how to clear any portion of code that is already entered?

p.s. I know I will get prompted to save data or not on the before update portion; however, I wish this to override it and cancel any changes once it is pressed...actually, even better would be to skip the question to save or not.
 
To undo a dirty record:

Code:
[b]Me.Undo[/b]
 
Perfect!! I think I am just going to do dissalow the close form option and add that code so only way they can close the form is to cancel what tehy put in..perfect!!

Now, one last chance they have to close the form without updating is if they close access in general...is it possible to remove the X in the very top corner of access as a whole? (i'd place a command button to close the program instead)
 
My preference is to create a property in each form like this.

Code:
Private mFormLocked As Boolean
Public Property Get FormLocked() As Boolean
    FormLocked = mFormLocked
End Property
Public Property Let FormLocked(Status As Boolean)
    mFormLocked = Status
End Property

On the form's Unload event:

Code:
Private Sub Form_Unload(Cancel As Integer)
    If Not Me.FormLocked Then Cancel = True
End Sub

If I want to close the form then I use:

Code:
Me.FormLocked = True
DoCmd.Close acForm, Me.Name
 
Perfect...absolutely perfect. I can't see any reason why the user would enter in dummy null data now... i think I have all angles covered :)

database X is disabled
form X is disabled
upon closing database, it cancels what they did (for accidental openings / enterings)
upon submitting it adds it...perfect )

Only thing they can do is ctl+alt+delete and end task, but none of my users will knwo how to do that :)

Thanks!!
 
dzirkelb said:
I can't see any reason why the user would enter in dummy null data now
You should consider changing the "required" fields property in your table to YES for all fields that must not be null for a new record. You can trap for the error if it were to happen. You can also test for nulls in the forms BeforeUpdate event to ensure no required fields are null. Search around for there are plenty of posts with code samples on how to do it.
 

Users who are viewing this thread

Back
Top Bottom