473,289 Members | 1,780 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,289 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 3205
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.