开发者

How to refresh listbox

开发者 https://www.devze.com 2022-12-13 02:08 出处:网络
What\'s the best way to refresh a list box in MS Access?The way I have tried it doesn\'t seem to work :-/

What's the best way to refresh a list box in MS Access? The way I have tried it doesn't seem to work :-/

This is my current method (onClick event of a button开发者_如何学JAVA on the same form):

Me.orders.Requery

I have also tried

orders.Requery

and

Forms!currentOrders.orders.Requery

but none of them seem to refresh the list box's contents - I see no new items, even though I know that there are some. Closing off the form, and then re-opening it does show the new items, however.


You could try and requery the form first and then requery the listbox


You need to use a temporary textbox, then your listbox will refresh automatically. The following solution worked for me. (I don't know why, but using direct value from searchbox didn't work for me.) i have used no button. For instant search:

  1. a textbox where you actually type. its name "Finder"
  2. a textbox where you save the searching string temporarily. its name "Search".
  3. a listbox where you show result. its name "lstResults"

(NB: also to mention, the query, uses the textbox named "Search"; which is our temporary textbox.)

code:

Private Sub Finder_Change()     ' "on change" event of "Finder" box
    Me.search = Me.Finder.Text  ' save the typed text in another textbox and use from there for query (otherwise it might not work)
    Me.lstResults.Requery       ' update listbox "lstResults" on any change
End Sub  

How to refresh listbox

How to refresh listbox


How to refresh listbox

0

精彩评论

暂无评论...
验证码 换一张
取 消