Transfer Data From Pop Up to Main Form

J

JD McLeod

I have a form called “time sheetâ€. When the user wants to calculate the
total hours worked, they click on a command button that launches another
pop-up form “time calculation†which allows them to enter in the start and
ending time. It then calculates the total hours worked. I would like for
this data on “time calculation†to be transferred to the “total hours workedâ€
field on the form “time sheet†when the “time calculation†form is closed.
Any advice is much appreciated. Thanks.
 
A

Albert D. Kallal

JD McLeod said:
I have a form called "time sheet". When the user wants to calculate the
total hours worked, they click on a command button that launches another
pop-up form "time calculation" which allows them to enter in the start and
ending time. It then calculates the total hours worked. I would like for
this data on "time calculation" to be transferred to the "total hours
worked"
field on the form "time sheet" when the "time calculation" form is closed.
Any advice is much appreciated. Thanks.

Two ways:

1) - in the time calculation form on the close event, simply stuff values
back:

eg:

forms![time sheet]!HoursWorkd = me!HoursWorked
forms![time sheet]!DaysWorked = me!DaysWorked

etc.....

2) - open target form as acDialog, have you code wait until user is done,
and then
grab values from that form.
I explain this here:

http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html
 
J

JD McLeod

Thanks Albert,
do i just type in the foumula below into the "on close" event box of the
form's properties? I recognize all of the syntax, except for the "me!" I am
new to Access and not sure what that means. I know how to link data from one
field on a form to the next, but not from different forms. I was thinking,
is there a way to have a the time calculation boxes hidden on the main form
and when the command button is pushed, they are visible and when you click
"close" button, they are hidden again? Thanks again for any help.

Albert D. Kallal said:
JD McLeod said:
I have a form called "time sheet". When the user wants to calculate the
total hours worked, they click on a command button that launches another
pop-up form "time calculation" which allows them to enter in the start and
ending time. It then calculates the total hours worked. I would like for
this data on "time calculation" to be transferred to the "total hours
worked"
field on the form "time sheet" when the "time calculation" form is closed.
Any advice is much appreciated. Thanks.

Two ways:

1) - in the time calculation form on the close event, simply stuff values
back:

eg:

forms![time sheet]!HoursWorkd = me!HoursWorked
forms![time sheet]!DaysWorked = me!DaysWorked

etc.....

2) - open target form as acDialog, have you code wait until user is done,
and then
grab values from that form.
I explain this here:

http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html
 
A

Albert D. Kallal

JD McLeod said:
Thanks Albert,
do i just type in the foumula below into the "on close" event box of the
form's properties?

Yes, kind of. You open up the form in design mode, display the property
sheet, click on the

on close property setting, and then you should see the [...] button
appear. You then click on that button, and then choose the code builder.

So, you don't really type the code in the "event box", but you wind up
typing the code into the code editor.....
I was thinking,
is there a way to have a the time calculation boxes hidden on the main
form
and when the command button is pushed, they are visible and when you click
"close" button, they are hidden again?

Sure, you could do that. That would mean you have lots of room on that
form and thus not really need the 2nd form then? This type of approach is
really up to you. You could also consider placing the form behind a "tab"
control...

You can see a tab control in following access screen shots:

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

(scroll down to last screen....note the tab controls called Payments,
Pricing, Udrive Info)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top