Pass Data from Unbound Form to Bound Form

J

JD McLeod

I have a form “NewTimeEntry_frm†that is used to populate a table called
“Timeâ€. On the “NewTimeEntry_frm†one of the inputs is hours worked. I have
a command button there that launches another form the use can use to enter
the start and end times and any breaks worked to determine the total hours
worked, if needed. This second form is called “TimeCalculation†and it is an
unbound form. I would like to be able to have the hours calculated in
“TimeCalculation†automatically passed back to the Hours Worked field on the
“NewTimeEntry_frmâ€. I tried the following in the On Close event of the Time
Calculation form, but it didn’t work:

Forms!NewTimeEntry_frm!Text11Time = Me.Text4

I also tried substituting in the form, field string name in place of the
“Me.â€, but nothing I tried seems to work. The “TimeCalculation†form is
unbound and I am not using it as a subform. It is just a stand alone form
used to calculate hours if needed. Any help would be appreciated.
 
M

Mark Andrews

Forms!NewTimeEntry_frm.Text11Time = Me.Text4 should work (period instead of
!) I thought it would work with ! like you have it as well.

assuming "Text11Time" and Text4 are names of controls on the forms and not
locked or something like that.

If not and you can't get it solved shoot me an email, I'll look at it.
Export just the 2 forms and the tables/queries needed to another db and
remove any sensitive data and send it my way. Contact info on my site.

Possibly a spelling mistake somewhere?

HTH,
Mark
RPT Software
http://www.rptsoftware.com
 
D

Dirk Goldgar

JD McLeod said:
I have a form “NewTimeEntry_frm†that is used to populate a table called
“Timeâ€. On the “NewTimeEntry_frm†one of the inputs is hours worked. I
have
a command button there that launches another form the use can use to enter
the start and end times and any breaks worked to determine the total hours
worked, if needed. This second form is called “TimeCalculation†and it is
an
unbound form. I would like to be able to have the hours calculated in
“TimeCalculation†automatically passed back to the Hours Worked field on
the
“NewTimeEntry_frmâ€. I tried the following in the On Close event of the
Time
Calculation form, but it didn’t work:

Forms!NewTimeEntry_frm!Text11Time = Me.Text4

I also tried substituting in the form, field string name in place of the
“Me.â€, but nothing I tried seems to work. The “TimeCalculation†form is
unbound and I am not using it as a subform. It is just a stand alone form
used to calculate hours if needed. Any help would be appreciated.


In what way doesn't it work?

It's possible that the Close event is too late to pick up the value of the
Text4 control on the form that is closing. However, I tried in on a simple
pair of forms in Access 2003, and it worked okay. Still, you might try
using the Unload event instead.
 

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