Refresh Data of Combo Box on a Subform

K

Kit Lau

Hi,

I have a combo box on a subform. If it's new data, it will open another
form and let users input the new data. After that, the new data cannot be
shown in the itemdata of the combo box. I use Requery for the combo box. It
works fine when the form is not linked to any forms. How can I refresh the
new item data on a subform?

Thanks in advance,
Kit Lau
 
A

Allen Browne

Try:

Forms.[NameOfYourMainForm].[NameOfYourSubformControl].Form.[NameOfYourCombo].Requery
 
K

Kit Lau

I tried that on OnClick event but it doesnt work. Any idea?

Allen Browne said:
Try:

Forms.[NameOfYourMainForm].[NameOfYourSubformControl].Form.[NameOfYourCombo].Requery

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kit Lau said:
I have a combo box on a subform. If it's new data, it will open another
form and let users input the new data. After that, the new data cannot
be
shown in the itemdata of the combo box. I use Requery for the combo box.
It
works fine when the form is not linked to any forms. How can I refresh
the
new item data on a subform?

Thanks in advance,
Kit Lau
 
A

Allen Browne

Set the On Click property to:
[Event Procedure]
Click the Build button (...) beside this.
Access opens the code window.
Enter the line there, between the "Private Sub..." and "End Sub" lines.

If that still fails, open your main form in design view.
Right-click the edge of the subform control, and choose Properties.
What is the Name of the subform control?
It may be different from its SourceObject (the name of the form that is
loaded into the subform control).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kit Lau said:
I tried that on OnClick event but it doesnt work. Any idea?

Allen Browne said:
Try:

Forms.[NameOfYourMainForm].[NameOfYourSubformControl].Form.[NameOfYourCombo].Requery

--

Kit Lau said:
I have a combo box on a subform. If it's new data, it will open
another
form and let users input the new data. After that, the new data
cannot
be
shown in the itemdata of the combo box. I use Requery for the combo
box.
It
works fine when the form is not linked to any forms. How can I refresh
the
new item data on a subform?

Thanks in advance,
Kit Lau
 

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