keep access from saving a record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyone,

I have created a DBA with the main form containing 3 sub-forms. I've
created a save button on the form. Here is the problem; you can still type
on the main form and it will update without clicking the save button. I know
some VBA code will be needed either in the before update event or after.
Could you help me narrow this down?

Sarita
 
you can set a constraint or a rule or use a trigger

you don't want to do this on the VBA side; what if someone disables their
macros??
 
Hi Everyone,

I have created a DBA with the main form containing 3 sub-forms. I've
created a save button on the form. Here is the problem; you can still type
on the main form and it will update without clicking the save button. I know
some VBA code will be needed either in the before update event or after.
Could you help me narrow this down?

Sarita

A Database Administrator...? Must be uncomfortable! <g>

More seriously: a Form with Subforms saves its record the moment you set focus
to any subform control. Normally a Form is used for the "one" side of a one to
many relationship; in order to maintain referential integrity, you must save
the main form's record before you can start creating records in the related
tables. It's fairly difficult (scratch tables...?) to have a form that lets
you fill out a main form record and multiple subform records without those
records actually being committed to your table. Why do you feel that this save
button is needed (as opposed to using Access' builtin automatic record
saving)?

John W. Vinson [MVP]
 
Hi John,

Your right I do have a one to many relationship in my tables. I don't want
them to make changes on the form unless the save button is pressed. If they
close the invoice it will still save the changes made. I don't want that to
happen. If the close button is pressed I dont want the changes made unless
the save button is pressesd.
 
Hi 69, Camaro,

Looks like I got him as well on "Splitting a field"

2 Questions how & who to do I report this and how do I delete his reply.

Trev
 
Hi John,

Your right I do have a one to many relationship in my tables. I don't want
them to make changes on the form unless the save button is pressed. If they
close the invoice it will still save the changes made. I don't want that to
happen. If the close button is pressed I dont want the changes made unless
the save button is pressesd.

What is "the invoice" in this context?

If there is a Form with three subforms, and many records on each subform, you
are editing data that already resides in four different tables... right? Do
you want the user to be able to make changes in (potentially) all four tables,
move around on the form, change this, delete that, add something else... and
then have nothing happen to the data in the tables until they click the
button?

If so, you're in for some work. You'll need to create four "scratchpad"
tables, using the same table structure as your invoice tables. The Form will
be based on these scratch tables. You will need to use the form navigation
tools (probably a Combo Box to select an invoice would be simplest) to run an
Append query to migrate data from the real tables into the scratchpad tables;
then your "save" button will run Update, Delete, and Append queries as needed
to update the real tables from the scratchpad tables. This can be done but it
can get pretty complex!

John W. Vinson [MVP]
 
Back
Top