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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing Combo Boxes

Status
Not open for further replies.

GaryRW

Programmer
Mar 8, 2002
67
GB
I wonder if any of you bright sparks can help...

I have a main form showing client details. Each client can have details of several contacts, shown on a subform. I have a combo box which allows the user to select which contact's details to look at.

Here's the pinch - I want to use the combo as the top of the form as a display box showing which contact you are looking at. The problem is when the user changes the client on the main form, the combo box still shows the details of the last person selected (which relates to the old client, not the one just selected).

I have refreshed the fields which updates the combo box list (requerying it didn't seem to work), I then manually set the caption of the combo box to the new data. The problem is that if I then try to change the focus back to another control I get an error (2115) saying Access can't move the focus (from the combo box).

Once the I have stopped the code running, then manually setfocus to the other control, it works fine. I thought it might be the NotInList, but I have tried running code on that event and nothing helps.

Is there something about requerying the combo box I don't know?
 
I am interested in knowing the answer to this question as well. I have the same problem but I am even more behind GaryRW. I have no idea how to refresh my combo box! Maybe you can help me with this Gary??
 
Hi Piovesan

'refresh form data:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

This works for me. I got it from the wizard when you place a refresh form data button on the form. Very Handy

 
By the way....you you want to refresh just the combobox and not the whole form.....you can use

NameOfComboBox.Requery

This will leave the form data alone but will refresh the ombobox....just an FYI. Programming isn't a profession of choice.
It's a profession of calling...
"Hey Programmer, your application broke again!" [spin]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top