Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 27th, 2005, 01:25 PM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default updating main form from subform

Hi All!

Been gone awhile!
I have a mainform - treatment
I have a subform - payment history
payment history is a continuous form

I keep the starting balance and balance due on the mainform

I want to update the balance due after I have entered an amount in the payment history subform - without leaving the subform.

Can anyone help!

Thanks,

Dartcoach

kevin

dartcoach
__________________
dartcoach
 
Old April 27th, 2005, 01:44 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   Without knowing where you are getting the data on your main form, can't you requery the control on the main form when the pertinent field on the sub form loses focus?



mmcdonal
 
Old April 27th, 2005, 01:51 PM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

The main form gets it's data from a table.

The sub form connects based on ID's.
Once I've entered a payment amount - I need to total all payments on the subform, then update the balance due on the main form. I've tried to refresh, requery, just about anything, but it won't refresh until I close the mainform and reopen it.

Thanks for your help.

dartcoach
Kevin

dartcoach
 
Old April 27th, 2005, 02:12 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Well, as a quick kludge, you can put code on the lost focus event of the pertinent field to grab the current main form id, then close the main form and reopen it using the current main form id to get the right record.

Someone here will come up with something more elegant shortly I am sure.



mmcdonal
 
Old April 27th, 2005, 03:40 PM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey All!
Got it to work!
Basically, all I did was after they enter a payment amount, I use the current record number, then make the subform invisible, then go to the first record, then loop thru adding the amounts until the end. Then I reposition at the correct record and then make the subform visible again. This cause a blink, but it's better than watching the loop thru the form records.

MMCDonal, thanks for your help! Also, if anyone has a better idea, I'll be glad to hear it!

Thanks again!

Dartcoach
Kevin

dartcoach
 
Old April 28th, 2005, 08:02 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you want to stop the blink (which I assume is the subform closing), you could

DoCmd.Echo False

before your code hides the subform, and

DoCmd.Echo True

after you code unhides the subform.
 
Old April 28th, 2005, 08:27 AM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks Randall,

I added the code you suggested. I still get the blink. Being an old mainframe cobol programmer, the blink doesn't bother me too much, even though I would like to get rid of it.

Thanks for your help!

Dartcoach
Kevin

dartcoach




Similar Threads
Thread Thread Starter Forum Replies Last Post
Synchronizing main form w/subform (i.e. backward) paladin Access VBA 7 April 19th, 2007 06:40 AM
Main/Subform linkage Ben009 Access 4 April 5th, 2006 01:07 PM
Moving total from Subform to Main Form Shepwad Access 1 March 10th, 2006 10:57 AM
MS ACCESS UPDATING A SUBFORM FIELD bernieregans SQL Language 1 February 3rd, 2006 04:26 PM
Filter subform from main form DBoulos Access VBA 2 October 30th, 2003 12:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.