Manual Insert?

tafnuef1

Registered User.
Local time
Today, 15:17
Joined
Apr 22, 2010
Messages
43
Is there a way Manual Save and stop automatic insert?

YOU FOLKS ROCK! Ok my final question and I am DONE! YAY..

Is there a way to set all of my form so it does not insert data into my tables untill the user hits my "SAVE" button? I know Access automatically moves the data as it is entered. How do I stop that from happening?
 
Last edited:
Hmm I read on the forum somewhere about optimistic and pessimistic save methods, but I can't remember what was said!

My first thought was to have all your text boxes unbound, then on clicking save, it kicks off an append query that pulls the data from all the text boxes and puts it in the right fields.
 
No need to use unbound forms. You use the Before Update event to determine when and what to save. You can have a boolean flag (set as a private variable at form module level) which if it is set to true can let the update go through. And you set that variable to true in your save button's code. If it is not true then you can cancel the update or ask if they want to continue with the record and if not discard it.
 
boblarson,

Can you give me an example of the boolean? I am inlearning mode and I am so green to programing methods. I have done so well by getting tips here. I have listed my controls below.

Main form:
field 1: Batch_Number_ID (number only)
field 2: Document_Count (number only)
field 3: Date_of_Audit (Date only)
field 4: Document_Type (Combo Box)
field 5: Prepper_Name (Combo Box)
field 6: Indexer_Name (Combo Box)

Sub Form:
field 1: Prepper_Error (Combo Box)
field 2: Indexer_Error (Combo Box)

If I can fix this auto update thing. My database is ready to go.
 
Unfortunately with a subform you are pretty much out of luck. The main form saves right away when you move from it to the sub form and the subform saves right away when you move to the main form. The way I usually deal with this is to have my relationships set so that Cascade deletes are in effect in the relationship between the table the main form is based on and the table that the subform is based on and then if I decide to "undo" the main form record by deleting it if it has already saved, then the subform record goes away too.

As for just a single main form (no subform) in the general declarations section of the form module you can use

Private blnSave As Boolean

and then in the save button you use:
Code:
blnSave = True
If Me.Dirty Then Me.Dirty = False

And then in the Before Update event of the form:
Code:
Cancel = Not blnSave
 

Users who are viewing this thread

Back
Top Bottom