473,387 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Prevent saving when switching between subforms

Hi again guys. I have a series of tables linked together with 1:1 relationships to a unique key with referential integrity enabled on the relationships. My data entry form is made up of 7 subforms. Because of the field limitation I cannot house all my entries on one form.

My problem is that when my user switches to another subform access tries to save the record. Access cannot save the record because there are required fields in some of the other subforms. Thus not allowing my user to switch subforms. If I disable referential integrity it creates orphan records.

Is there a way that I can disable the auto-save that access uses between subforms and use a simple save button in its place. This way my user can enter all the data needed then his save and prevent a required field not being filled error.

Or

Can I somehow dynamically update the foreign key? Keep in mind that this is in a new record setting.

Any suggestions would be appriciated.

Furthermore, My Primary key is AutoNumber and my Foreign key is set to LongInteger. I have set both the child and master properties on each subform.
Dec 29 '11 #1

✓ answered by NeoPa

I don't know if this helps (as I don't understand much of the question), but when moving the focus away from a form in Access the form will never maintain it's dirtied (changed but not saved) state.

It will do one of three things :
  1. Save the data automatically (Default).
  2. If the Cancel parameter is set to True in the Form_BeforeUpdate() event procedure then the form will not lose focus. The changes will still be there, but the focus will not have moved away.
  3. If the changes are all cancelled (either by code in the same event procedure or by the operator pressing [ESC] prior to moving focus away from the form) then the focus will move away but there will be no remaining pending changes.

In no situations will it be possible to move focus away while maintaining any pending changes though.

6 8770
Mihail
759 512MB
I post a similar question in this forum but with no answer. (http://bytes.com/topic/access/answer...-update-record)

So I start to think that is not possible to stop the automatic update.

Yes. You can update the foreign key.
Assign to the control you need, as default value, the foreign key's value.
Expand|Select|Wrap|Line Numbers
  1. MyControl.DefaultValue = ValueOfForeignKey

Use the DefaultValue property in order to be able to exit from a new record, without troubles, if nothing else is typed.
Dec 30 '11 #2
there is the navigation form's panel (typically the buttons on the left). every button is one form. if you press another button in the middle of a form's completion, the form switches and if there is no ristrictions, submits the data(something i didnt want).BUT
if you make the form open by a button, AND open as "dialog"...so it opens the form you choose, in a dialog box, where you have no option to press something else, except for SUBMIT it and EXIT...
so it works perfect!!
Dec 30 '11 #3
Thanks for the thought process guys.

I've decided to make a new form that the user inputs basic information on the clicks a button and saves it. Then a second form opens with the fields from the first form and all other fields I need. Since the basic info entered on the first form is saved it has already asigned a primary key. Now all keys are asigned appropriately and it will not allow orpan records.
Dec 30 '11 #4
NeoPa
32,556 Expert Mod 16PB
I don't know if this helps (as I don't understand much of the question), but when moving the focus away from a form in Access the form will never maintain it's dirtied (changed but not saved) state.

It will do one of three things :
  1. Save the data automatically (Default).
  2. If the Cancel parameter is set to True in the Form_BeforeUpdate() event procedure then the form will not lose focus. The changes will still be there, but the focus will not have moved away.
  3. If the changes are all cancelled (either by code in the same event procedure or by the operator pressing [ESC] prior to moving focus away from the form) then the focus will move away but there will be no remaining pending changes.

In no situations will it be possible to move focus away while maintaining any pending changes though.
Dec 30 '11 #5
Thanks, NeoPa!

As always, your post was a brilliant way to explain what I was thinking but using the actual terminology.

Have a Happy New Year to all posters!
Dec 30 '11 #6
NeoPa
32,556 Expert Mod 16PB
Thank you. I'm pleased that helped :-)

Happy New Year to you too.
Dec 30 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dennis Wheeler | last post by:
I'm trying to find a commandline solution for switching projects. Currently I have to modify the IIS virtual directory path to the source files, and then open the solution file in .Net to be...
2
by: Johann Blake | last post by:
The following is a bug I have discovered using tab pages and threads and I am looking for a workaround. Create a new Windows Forms application and add a tab control with two tab pages. Add a...
12
by: Jacob Crossley | last post by:
Please tell me there is a way to prevent this annoyance ; - ) I'm into writing perfectly indented html, but the .net dev environment is being overzealous and messing up my html formatting. for...
1
by: Solx37 | last post by:
I am trying to figure out how to prevent scrolling when I append text. It scrolls to the bottom whenever I use AppendText. It jumps to the top whenever I += text to the Text property.
3
by: Simon Verona | last post by:
I have a parent form which contains a toolbar. The toolbar controls the loading and switching to of MDI child forms. The code for the toolbar click event and one of the subroutines that loads...
1
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working...
13
by: MLH | last post by:
I have a form, frmVehicleEntryForm. On it is a subform control named frmAddnlOwnrListSubForm. The subform control's source object is frmAddnlOwnrListSubForm. When I click on the subform control,...
7
by: Michiel Rapati-Kekkonen | last post by:
Hi, I would like my record to be saved only when my own close button (with all it's checks) is used. I made the winodws close button disappear, but you still can close using the right mouse...
1
by: cbayr249 | last post by:
I'm currently making a database for a research project and I keep running into a problem. I have one master form with the tab control and several subforms. Each subform is backed by a table that are...
6
by: Kaloyan Krumov | last post by:
I have the following set up: Tables Supplier SupplierContacts Forms SupplierRegform SupplierContacts - subform On the main form I’m using tab control with two tabs. The first tab contains...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.