We help IT Professionals succeed at work.
Get Started

combobox and subform problem

Last Modified: 2012-05-11
I have a combobox on a main form.  
The main form does not have a record source.
The record source of the combobox is a table.

I have a subform on the main form. The subform's record source
is a table (different from the one tied to the combobox).
I have a textbox in the header section of the subform.
I want to set its value to whatever the combobox's value is.
If the combobox value changes, I want the textbox value on the subform
to change.

Below is what I already have under the After Update event of the combobox.
What is going on is when a combobox selection is made, the table tied
to the subform is cleared and then populated with data related to whatever
the combobox selection is.  

Private Sub MyComboBox_AfterUpdate()

With DoCmd
   .SetWarnings False
   .Hourglass True
   .OpenQuery "DeleteTemporaryTable"
   .OpenQuery "PopulateTemporaryTable"
   .SetWarnings True
   .Hourglass False
End With

Adding this code to the AferUpdate event (I've tried placing it in different
sections of the code) is causing a 440 run-time error:

 Me.MySubform.Form.MyTextbox = Me.MyComboBox

What's the problem?   Thanks.
Watch Question
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE