473,416 Members | 1,544 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,416 software developers and data experts.

Subform data not saving when focus moves to parent

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 with. If a
user enters data in a subform, then directly clicks the command button
on the parent form, the data in the subform is not included in their
document. I THOUGHT that as soon as focus left the subform, any
pending changes to the data were saved. In fact, in googling "dirty"
and "subform", the general feedback that I've seen suggests that you
don't need to test for a dirty subform, since it will never be dirty
since it's saved by the time the code for the command button is
executed. But that is clearly not what I'm experiencing.

When this does happen, all I have to do is move their cursor to another
record or into another subform, and THEN the data saves. But not when
moving directly from editing a record in a subform, to a command button
on the parent. Any ideas why the subform is not saving when I move to
the parent? If I do have to test for dirty subforms, that is fine, but
one question I have: if I test for dirty subforms, find any, then do a
save record command, does that automatically save the records in all
the subforms? I'm not aware of any way to direct WHAT is being saved.
(?)

Dec 5 '06 #1
1 3213
What you wrote (the CurrentRecord in Subform is saved when the Focus is
moved from the Subform to the MainForm, e.g. Focus in the Subform and the
CommandButton on the Subform is activated) is true. However, there may be
timing issues and the update may still be in cache pending so the Report
(which gets the data from the Table) may not pick up the new (or being
edited) Records ...

A a test, try moving athe Focus from the Subform to the MainForm, wait about
5 seconds and then activate the Command Button and see if the new (or being
edited)Record (from the Subform) is picked up.

If this is the case, you may like to use the Idle method with dbRefreshCache
option before the OpenReport statement in the CommandButton_Click Event ...

--
HTH
Van T. Dinh
MVP (Access)

<go****@darincline.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
>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 with. If a
user enters data in a subform, then directly clicks the command button
on the parent form, the data in the subform is not included in their
document. I THOUGHT that as soon as focus left the subform, any
pending changes to the data were saved. In fact, in googling "dirty"
and "subform", the general feedback that I've seen suggests that you
don't need to test for a dirty subform, since it will never be dirty
since it's saved by the time the code for the command button is
executed. But that is clearly not what I'm experiencing.

When this does happen, all I have to do is move their cursor to another
record or into another subform, and THEN the data saves. But not when
moving directly from editing a record in a subform, to a command button
on the parent. Any ideas why the subform is not saving when I move to
the parent? If I do have to test for dirty subforms, that is fine, but
one question I have: if I test for dirty subforms, find any, then do a
save record command, does that automatically save the records in all
the subforms? I'm not aware of any way to direct WHAT is being saved.
(?)

Dec 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: YFS DBA | last post by:
How do I use VBA to insert a *new* record into a subform? I have a master form with client information, and a sub form with billing information. I want to click on a button ("Add Data") and have...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
4
by: Michael Fay | last post by:
There have been threads in this newsgroup explaining how to tab out of a subform to the parent form -- without having to use ctrl-tab (of which users might be unaware -- and at any rate, they...
5
by: Susan Bricker | last post by:
Hi. I have a Main form with a subform that has a subform. I have an 'Add Event' button on the Main Form that issues the following instruction: DoCmd.GoToRecord , , acNewRec If the record...
5
by: PC Datasheet | last post by:
Is there a way to page through a subform using PageDown and PageUp? Thanks! Steve PC Datasheet
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
1
by: Reginald Bal | last post by:
Main Form/SubForm When I requery or recalc my parent form after I updated a record in my subform, I lose the focus of that particular record in my subform. Instead, the first record is selected....
9
by: ApexData | last post by:
My main form has tab-pages. On each tabbed page is a subform control containing a different subform. When a user selects a specific tab and begins to edit a record, I need a way of preventing the...
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,...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.