Gil wrote:
What i am trying to do is have the combo box filter to the text being
entered.
The combo1 rowsource is:
SELECT * FROM tbl WHERE field1 Like combo1 & "*"
The code looks like this:
Private Sub combo1_Change()
Me.combo1.Requery
End Sub
When i do this i get the following error:
"Your must save the current field before you run the requery action."
This is because as you are entering characters, you are changing the
text property of the combo box and not the value.
Of course, I don't know what the purpose of this is within your
application, but I don't think this is a wise idea.
It sounds like you are using the combo for a dual purpose, to narrow the
number of possible choices down AND to make a selection. In my own
(emphasize "my own") experience, users are easily confused by controls
which perform multiple and different functions.
I do the following in a successful app, although it's against a list
box, but it's the same principle.
I put in a separate text box, say txtSearchEnter. To avoid the message
you mention, I then put in a second, _invisible_, text box, say
txtSearch. The purpose of the second text box is to save each change
made to the text. So, in the visible text box into which the user
enters text, I have the on change event as follows:
Private Sub txtSearchEnter_Change()
Me.txtSearch = Me.txtSearchEnter.Text
Me.Combo1.Requery
End Sub
The combo1 (I think you ought to rename this control name to something
that's a bit more intuitive, like cboChoice or something, but that's
your call) rowsource would then be:
SELECT * FROM tbl WHERE field1 Like txtSearch & "*"
--
Tim
http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me