Reference unbound control in 2nd form thru VBA

Premy

Registered User.
Local time
Today, 12:27
Joined
Apr 10, 2007
Messages
196
--Access 2003 winxp Pro SP2--

Hi there, this apparently simple problem had me stay up all night without finding the solution, neither by myself nor by searching this forum or the web.

Say I have 2 loaded forms: TopForm and BottomForm. BottomForm has an unbound textbox txtRefValue, in which I typed 20.

TopForm has an unbound textbox txtShowValue and a button with the following click-event code:
Me.txtShowValue = Forms!BottomForm!txtRefValue

But when I click the button, the 20 I typed in BottomForm does not show up in TopForm's txtShowValue.

I regularly reference unbound controls this way in queries, and they work as expected. Does this simply not work in VBA or am I doing something wrong (more likely)? I saw it works with a bound control, but even then only after saving the form (in this case BottomForm). But I needed to be able to load the value from txtRefValue on the fly.

Thanks in advance for your help.
Jaime.
 
That should work for you no problem. Can you post an example? Maybe the textbox still has focus so the value of twenty has not been committed to the control
 
I'll be d....!

Thank u Keith, that was a real stupid one I did there. I guess I implicitly suppossed that switching forms would switch focus...

Forgive me all ya forumers for this blunder.

:o :o :o

Regards,
Jaime
 

Users who are viewing this thread

Back
Top Bottom