Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 01-30-2008, 04:22 AM   #1
Chromedome
Registered User
 
Join Date: Jan 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Chromedome is on a distinguished road
Unhappy Pass Data from Calculated Field to Table Field

Hi Everyone
Bit of a 'newbie' to Access 2007, but getting there.
Can anyone point me in the right direction:

I have a calculated field on the Main Form which I need to pass to a Table Field on the SAME form when the Calculated Field is updated.

I can get it to pass the data with the [On_Click] event but can't get it to pass it automatically with the [After_Update] or [On_Change] event

Can anyone point me in the right direction?

Thanks in advance

CD

Chromedome is offline   Reply With Quote
Old 01-30-2008, 04:38 AM   #2
KenHigg
Registered User
 
Join Date: Jun 2004
Posts: 13,306
Thanks: 8
Thanked 155 Times in 129 Posts
KenHigg has a spectacular aura about KenHigg has a spectacular aura about
OnExit or OnDirty

???
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

ken

“You don’t learn to walk by following rules. You learn by doing, and by falling over.”
KenHigg is offline   Reply With Quote
Old 01-30-2008, 05:08 AM   #3
Chromedome
Registered User
 
Join Date: Jan 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Chromedome is on a distinguished road
Thanks KenHigg for your speedy reply
The On_Exit event works, but I have to select the field and then move off it (Exit) for the event to trigger (which is what it is designed to do).

The Calculated field updates instantly when I enter data in the subform and I wanted to update the Table Field in the same way. Had it working OK in ObjectPal but it's time to move on. Is there a way to automate it without user intervention?

Don't quite understand the 'Dirty' event.
The bit of simple code I'm using is as follows:
Private Sub TotalJobList_Exit(Cancel As Integer)
Dim TJL As Control
Dim TJ As Control

Set TJ = Me.TotalJob
Set TJL = Me.TotalJobList

TJ = TJL

MsgBox ("TJ Value " & TJ)
End Sub


hope you can help

Regards

CD

Chromedome is offline   Reply With Quote
Old 01-30-2008, 05:30 AM   #4
Chromedome
Registered User
 
Join Date: Jan 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Chromedome is on a distinguished road
Hi again Ken

Looks like the Dirty property could do it if I understand it. While the Field is updated, but not saved, it is in its 'Dirty' state?

If this is correct then if Dirty is 'True' should I be able to copy the unsaved (but updated) Calculated Field data to the Table Field?

Could you point me in the direction of the basic code I would need to effect this?

Look forward to your reply

Sorry to be a 'nag'

Mark
Chromedome is offline   Reply With Quote
Old 01-30-2008, 07:45 AM   #5
KenHigg
Registered User
 
Join Date: Jun 2004
Posts: 13,306
Thanks: 8
Thanked 155 Times in 129 Posts
KenHigg has a spectacular aura about KenHigg has a spectacular aura about
You are correct how OnDirty works.

I'm not real clear on what you are trying to do but I like to add that if at all possible you shouldn't be storing the data in a second place but get it as you need it from the original.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

ken

“You don’t learn to walk by following rules. You learn by doing, and by falling over.”
KenHigg is offline   Reply With Quote
Old 01-30-2008, 08:48 AM   #6
Chromedome
Registered User
 
Join Date: Jan 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Chromedome is on a distinguished road
Hi Ken
Basically it is pretty simple (but if it can be simpler...):
I have a [JobsMain] Form with a [LineItem] SubForm.
On the JobsMain Form is a calculated field [TotalJobList] which collects the data from a calculated field in the Footer (notVisible) of the LineItem SubForm [=sum([List]*[Qty])]

In the JobsMain Table I have a currency Field [TotalJob] in which I need to store the calculated data from [TotalJobList] for use in the [ProjectsMain] Form.

Thus: in the [ProjectsMain] Form we can see the costs for all the individual Jobs within the Project plus see the total cost of the whole Project to date.

Hope this makes sense and look forward to your reply

Mark
Chromedome is offline   Reply With Quote
Old 01-30-2008, 09:40 AM   #7
KenHigg
Registered User
 
Join Date: Jun 2004
Posts: 13,306
Thanks: 8
Thanked 155 Times in 129 Posts
KenHigg has a spectacular aura about KenHigg has a spectacular aura about
You shouldn't be storing this. You should get it on the fly whenever you need it with either a domain function (dsum()?), a custome function a maybe a sql statement...

The main problem is that you'll have the value twice that could get out of sinc...


__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

ken

“You don’t learn to walk by following rules. You learn by doing, and by falling over.”
KenHigg is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
add a new field (column) to a table with data mgunesen Queries 1 01-27-2008 03:17 AM
Saving data in a form field to a table field Repoman75 Forms 10 01-24-2007 08:57 AM
Copying data in one table to another-how to? jjh Tables 1 01-12-2007 11:25 PM
save data from a calculated control to a field in a table CliveJ Forms 2 09-15-2006 03:48 PM
how can I copy data field from form into data field in table Rdbui Modules & VBA 3 11-16-2000 08:22 PM




All times are GMT -8. The time now is 08:05 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World