Automatically refreshing a listbox

simongallop

Registered User.
Local time
Today, 23:54
Joined
Oct 17, 2000
Messages
611
I am trying to view details in a list using a combo box and a textbox to narrow the criteria. I want the textbox to behave the same way as in Help where whilst you are typing, the list is updated. The combobox is to limit the selection by category.

I have an On Change code of me.refresh but that also refreshes the textbox which means that I can't type more than one letter (unless I reposition the cursor with the mouse). I have also tried Forms!frmX!lstBox.requery which has less success.

What am I doing wrong? Is there any VB code to position the cursor within the textbox?

Thanks in advance

PS If you saw the previous message hope that this is a bit clearer!!

[This message has been edited by simongallop (edited 10-18-2000).]
 
Try to Refresh the text box on AfterUpdate event instead. In this case you have to type in the whole word, press Enter, then your combo box will be updated.
Another option would be to make the text box a combo box (cascading combo boxes).
 
Have made a little test db that I could send to you. Basically the event to use is the Key Up event of the field you want to enter the Search Criteria. In this event you use the text property of the Text Field to get the value of the current string. Use Len to get the Lenght of the current string. Then make a query string that uses Mid([field_to_be_searched],1,Len(Text Field)) as it's condition. Specify the query to sort the records by the field to be searched and set the List box's RowSource property to the query string.
Send me an email if you want the example.

chrismcbride@meridiansci.com

Chris
 

Users who are viewing this thread

Back
Top Bottom