How can you lock a combo box so that the user can't delete the name that is shown, but can still select another name?
If it was a textbox, I would lock it, but you can't do that with a combobox and then select another name from the list.
Printable View
How can you lock a combo box so that the user can't delete the name that is shown, but can still select another name?
If it was a textbox, I would lock it, but you can't do that with a combobox and then select another name from the list.
Set the Style property to 2 - Dropdown List.
Either just use a list box , or set the Style to 2 - drop down list
I can't do that because of the following code:
rstOwner.Open "SELECT * from ATMOwnerContacts where OwnerName='" & cboOwner.Text & "';", cnn
cboOwnerContact.Text = rstOwner!contact
txtPhoneNumber = rstOwner!Phone
txtExtension = rstOwner!extension & ""
txtFaxNumber = rstOwner!fax
txtEmail = rstOwner!Email
I get the error 'Read Only'.
Try this:
Code:Private Sub Combo1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
That worked great with one exception.
What if they highlight the word and then press delete? It does delete then.
Any suggestions on how to prevent that?
Try this smh....
Code:Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
KeyCode = 0
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Thanks guys...it works great!
Found another problem smh, if the user highlights the text and presses the space bar the text can still be deleted.
Nevermind I did something stupid!! :o :eek: :o