subform help (1 Viewer)

lipin

Registered User.
Local time
Today, 02:00
Joined
May 21, 2002
Messages
149
I have a main form with a subform. I need a textbox called "ProductCode" to equal a textbox on the main form called "txtpc1".
After I have entered last field in main form I shift focus to the subform that works great, and the first field on the subform is the "ProductCode" so the focus goes to there.

On its Got Focus property I have the following:
ProductCode = [Forms]![Overage2]![txtpc1]

Overage2 is the name of the main form.

However, I get nothing in "ProductCode" on my subform and can't figure out why.
 

llkhoutx

Registered User.
Local time
Yesterday, 20:00
Joined
Feb 26, 2001
Messages
4,018
On its Got Focus property I have the following:
ProductCode = [Forms]![Overage2]![txtpc1]

Your code on that line is invalid, it should be a function call, a macro call, or and Event Procedure, but not executable code.

Create a form module, fired by the GotFocus of event of ProductCode which executes your code.

Solution:

The gotFocus propterty of ProductCode should have "[Event Procedure]" (without the quotes), then click the "Choice Builder", the "..." button to the right of that property, selecting "Code Builder". to build the following:

Private Sub ProductCode_GotFocus()
ProductCode = [Forms]![Overage2]![txtpc1]
end sub
 

Users who are viewing this thread

Top Bottom