472,808 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,808 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 3150
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,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.