473,473 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to add/save items to a continuous subform using command button on main form?

beacon
579 Contributor
Hi everybody,

[Access 2003]

I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button on the main form that I'm going to be using to submit the data.

The main form is bound to a query, qryPatientDetail, and is filtered using a search form. The subform is currently linked to the main form with PatientDetailID as the Master and PatientDetailIDFK as the Child. Currently, the subform is bound to a query called qryEpisodeDetail, but I'm wondering if I shouldn't make it unbound.

Here's my dilemma. When a user searches for a patient using the search form and the main form is filtered, I want the subform to show all records that have been entered. However, if new records are entered, I don't want those to save until the user clicks the submit button on the main form.

Currently, the users access the subform and anything they enter is automatically saved to the underlying table and the submit form is just a way for the user to get back to the switchboard.

I can make the subform unbound and load the record source in the Form_Load event for the subform when the subform loads inside the main form, but that doesn't resolve the issue with being able to prevent records from saving until the submit button is pressed.

Just in case it matters, the main form is set to allow edits, but not additions, deletions, or data entry. The subform is set to allow edits, deletions, and additions, but not data entry.

Is it possible to have a subform load with previously entered records, but not save new records until the user clicks the submit button on the main form? Will I need to make each of the controls unbound too?

As always, I appreciate the help,
beacon
Jan 22 '11 #1
4 4102
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
In short: Yes.

I think the approach to use here, would be to have a field in your table, lets call it b_Submitted. Set the default value of the field to False.

Now when a user starts entering data, the default will mark the record as not submitted.

When the user clicks submit (And probably also if the user closes the form through other means) you ask the user if he wants to submit the X records he made (you could count them for him)

If he says yes, simply run a update query, setting b_Submitted=True for that patient ID. If he says no, run a delete query for that patientID deleting all fields with b_Submitted=false

You should probably add a check of some sort, where you scan the table for "old" unsubmitted records, and decide what to do with them, since its possible if a user closes access (Or gets a Blue Screen of Death) that he will not have had the chance to select whether or not to submit the data.
Jan 24 '11 #2
beacon
579 Contributor
What about if the user is updating a row that has already been submitted and they decide to close without saving their changes?

If I set the b_Submitted = False for the rows that have been updated, then when the form is closed I wouldn't be able to revert back to it without something else to track which fields were updated and the original values, right?
Jan 24 '11 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
There may be smarter ways of doing this, but in this case what I would probably do, would be to make a temporary table, and when the user moves from 1 record to the next in your main table, you delete/populate the temporary table, while keeping track of which records have changed.
Jan 24 '11 #4
beacon
579 Contributor
I was afraid of that. I didn't really want to get into having to create temporary tables for this database, but there be no other way around it.

Thanks for your help TSO!
Jan 27 '11 #5

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

Similar topics

2
by: chris vettese | last post by:
I've been having trouble with this for a long time. I have a form that has many subforms. In the subforms I have unbound text boxes in the footer that sum a field. I want to Display this sum on...
1
by: Argus Rogue | last post by:
Hello All Access Guru's: I was wondering if you could assist me with a little problem that I am having using subform. Is it possible to scroll down a subform to a particular record, click on...
9
by: freeskier | last post by:
I am working on a form to edit student field placements. the student is selected from a combo box (cboStudent) which then populates a list box(lstPlacements) with field placements for that student....
4
by: sirimanna | last post by:
hi, Is any one can help me to open files in my computer(for an example: some word document)using command button... i want to open file's using my vb programme..but i can't do it...can any one...
2
by: rlamber | last post by:
Hello, I have 2 subforms in a Main form, one links fine, the other doesn't. I am trying to link them both to a "tracking ID" on the main form. The Tracking ID is a text field that is a combination...
2
by: darnnnel | last post by:
Hi everyone! I’m not sure how to even begin. I have a form and a subform and they are not linked. I would like to have a button on the form that would only change the data in the subform,...
1
by: Moish | last post by:
I have a form that does not have any bound fields. I want to open a subform on that form to a specific record based on the value of an unbound field on the main form. Obviously the subform is not...
1
by: greenstein | last post by:
Hello, I really need some help. I have a main form in Access 2000, with a subform, some of the fields in the subform are not saving to the table. When I search the Main form for the information,...
1
by: sknaina | last post by:
Hi Eveybody, I've a main form with a continuous subform based on 'DonorTranSmasterF' & 'DonorTranSdetailsF' , both tables are linked via 'DonorTransiD' field. I know & learn , How to save record...
1
by: dekk | last post by:
Hi, I have a main form ("frm_TimeParent") and a subform ("frm_TimeChild"). Issue: How do I refresh the combo box values in the subform once the contract has been selected in the main form? ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.