![]() |
Making a combo box user freindly
I am using a form in a spreadsheet to select customers. I can use my mouse
and select the customer. I would like to type in the box to select the customer by name instead. I have seen it work in other applications. I just cannot figure out how to make it work. Private Sub cboCustomerID_Change() If Not IsNull(Me.cboCustomerID) Then LoadStoreList LoadSOForCustomer Me.cboCustomerID End If Me.cboStoreID.SetFocus End Sub Private Sub cboStoreID_Change() If Not IsNull(Me.cboStoreID) Then LoadSOForStore Me.cboStoreID Else If Not IsNull(Me.cboCustomerID) Then LoadSOForCustomer Me.cboCustomerID End If End If Me.lstShippingOrders.SetFocus End Sub When I have selected the customer with the mouse or start typing I loose focus, because of the Me.cboStoreID.SetFocus after the End If. This was written by some one else and I am trying to modify it to make it more user friendly. Thanks for the help. -- Thanks Mark C. |
Making a combo box user freindly
Hi Mark,
Instead of running the code on the on Change event if you change it to the AfterUpdate event. This means that the user can change it/type it and then your code will run when the user moves away either by clicking into another text box or pressing tab etc. James |
Making a combo box user freindly
Thanks James
That made it do what i wanted, now i get a " Runtime error: 9 - Subscript out of range" . I am trying to find the error in the code. If you have any ideas let me know. -- Thanks Mark C. " wrote: Hi Mark, Instead of running the code on the on Change event if you change it to the AfterUpdate event. This means that the user can change it/type it and then your code will run when the user moves away either by clicking into another text box or pressing tab etc. James |
Making a combo box user freindly
Hi Mark,
From the code you posted I can't see anything obvious, which line does it highlight the error with? Subscript out of range is typically an error assosiated with not finding a particular object like you telling the code to select sheet4 when in fact you don't have a sheet4. Alternatively you can email it to me. James |
All times are GMT +1. The time now is 04:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com