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

Refresh ALL List and Combo Boxes in one step 1

Status
Not open for further replies.

corner40

Technical User
Nov 20, 2002
126
0
0
CA
Hi everyone
is there a way to refresh/requery all the combo boxes and listboxes on a form/forms in one easy step as opposed to <controlname>.requery and hoping that the code fires when hoping, etc. I just keep seeming to have listboxes displaying the wrong info because of not updating.
any help/suggestions would be great
Thanks
jeremy
 
How are ya corner40 . . . . .

ListBoxes don't work well with requery, Combos OK. In the [blue]Tag Property[/blue] for each add [purple]Req[/purple]. Then use thefollowing code:
Code:
[blue]   Dim ctl As Control
   
   For Each ctl In Me.Controls
      If ctl.Tag = "[purple][b]Req[/b][/purple]" Then
         If ctl.ControlType = acComboBox Then
            ctl.Requery
         ElseIf ctl.ControlType = acListBox Then
            ctl.RowSource = ctl.RowSource
         End If
      End If
   Next[/blue]

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1 said:
ListBoxes don't work well with requery

Thats not my experince.
I use
Code:
Me.myListbox.Requery
all the time, and it works.

But I have done some mistakes before I fully understod listboxes.
I used to first set the rowsource and do a requery to se the result. Not goog for the user, double the wait time.

Markus
 
Ho are ya Larsson . . . . .

I certainly wouldn't doubt you, but I have 6 failures logged. Two with Query & one 5 with Value List. Enough for me not to trust it.[/b][/blue] In each case [blue]Me.RowSource = Me.RowSource[/blue] worked just fine

Try [blue]Requery[/blue] with Value List!

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top