Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing values in ComboBox

Status
Not open for further replies.

madu

IS-IT--Management
Feb 20, 2002
11
US
Hello,

I am a beginner and have the following problem, any ideas to solve this would be great.

I have two data entry forms.From one form(Say Form A) I am saving some data into the table(say Table A).In the second form(Form B) I have a combo box which is getting its value form the table A.
The problem is once I save the values from the Form A to Table A, from the save button itself I am going back to Form B.But I don't see the new value in the Combobox.But if I close the Form B and come back again I can see the new value I added from Form A in my combo box.
So is there a way that I can refresh or requery the Form B so that it gets the new value from Table A the instant I go back to Form B from Form A.
Please help!,

Thanks,
Madu.
 
Add the following code in the form B.

****
Private Sub ComboBox_GotFocus()
me.refresh
End Sub
****

Seaport
 
Hi Seaport,

I tried this code in the form B, but still no change.I need to close the application and open it again to see the new value.
Do you think since the combo box is getting it's value from the table A, it is not possible to see the value in the combobox until it requeries the table???

But thanks for the reply,

Madu.
 
Your idea about the two forms is no mistake and should be doable.

Try the following code in the form B.

****
Private Sub ComboBox_GotFocus()
comboBox.requery
End Sub
****


Seaport
 
Madu,
I was having the same problem as you. If you're still unable to see the values in your table without closing and re-opening. Here is the solution that was given to me by JerichoJ (It worked great):

As far as your Combo box concern. After your code runs that enters the new values into the table, issue the following:

Me.ComboBoxControlName.Requery

This will pickup the new value(s).
 
Thank you SeaPort,
The code worked!!


Andrea, I couldn't put the code in Form A since I don't have combo on that form(where I am doing the saving),
But thanks a lot, I can use it in my other forms!

Madu.

 
Hello again,
When I requery and get the new values, it is at the bottom of the list,is it possible to make it appear in the combo box, ie without needing to open the combo box(pulling down the list)??The new value should appear in the combobox window .

Thanks,
Chaithra.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top