468,766 Members | 1,268 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,766 developers. It's quick & easy.

Erratic behavior in combo box typing completion search

A2K

I have a combo box that shows the content of a last name field from a
table. I use it to locate records in the table form.

I can open the form and locate several names quickly by placing the
cursor inside the drop-down list and typing the first few letters of
the name I want to find. Then, for no apparent reason, the list just
stops responding to subsequent searches for names that I KNOW are in
the list. The list contains no more than 300 names.

What am I overlooking?

Thanks.
Nov 13 '05 #1
4 3490
Have you turned the Allow Autocorrect property off?

--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
Nov 13 '05 #2
On Mon, 4 Apr 2005 07:47:59 -0400, "Darryl Kerkeslager"
<ke*********@comcast.net> wrote:
Have you turned the Allow Autocorrect property off?


Well, no I have not. Not sure I understand what that property does.
If I DO turn it off, what event should contain the following command?

Me.cboFindLName.AllowAutoCorrect = False

I have attempted placing this code in the form Open event and in the
OnEnter event of the control. Has no effect on the problem.

=======================
The code I'm using looks like this:

Private Sub cboFindLName_AfterUpdate()
On Error GoTo HandleErr

' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[UID] = " & Str(Me![cboFindLName])
Me.Bookmark = rs.Bookmark

....
Nov 13 '05 #3
"Lauren Wilson" <pr*****@nospam.com> wrote
"Darryl Kerkeslager" <ke*********@comcast.net> wrote:
Have you turned the Allow Autocorrect property off?
Well, no I have not. Not sure I understand what that property does.
If I DO turn it off, what event should contain the following command?


You can set the property to false in the property sheet of the combobox.
Allow Autocorrect allows Access to 'fix' words that it thinks you have
misspelled. Consequently, you may search for a last name of "Wheer", and
not find it because Access changes it to "Where". Sinister little things to
even notice; I religiously make sure it is turned off in every textbox and
combobox.

=======================
The code I'm using looks like this:

Private Sub cboFindLName_AfterUpdate()
On Error GoTo HandleErr

' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[UID] = " & Str(Me![cboFindLName])
Me.Bookmark = rs.Bookmark

...


If that does not fix the problem (apparently not), then I'm not sure what it
is. However, I would offer a suggestion that might help, regardless: It
looks like the bound column of your combo box is the last name field.
Assuming you have a numeric primary key field, use that instead, as the
combo box's bound value. As long as the last name is the first *displayed*
column, you still get the benefit of the Autoexpand, and you get a faster
and more reliable FindFirst:

rs.FindFirst "PrimaryKeyFieldName=" & Me!cboFindLName.Value

This *may* also fix your problem.
--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
Nov 13 '05 #4
On Tue, 5 Apr 2005 00:00:14 -0400, "Darryl Kerkeslager"
<ke*********@comcast.net> wrote:
"Lauren Wilson" <pr*****@nospam.com> wrote
"Darryl Kerkeslager" <ke*********@comcast.net> wrote:
Have you turned the Allow Autocorrect property off?


Well, no I have not. Not sure I understand what that property does.
If I DO turn it off, what event should contain the following command?


You can set the property to false in the property sheet of the combobox.
Allow Autocorrect allows Access to 'fix' words that it thinks you have
misspelled. Consequently, you may search for a last name of "Wheer", and
not find it because Access changes it to "Where". Sinister little things to
even notice; I religiously make sure it is turned off in every textbox and
combobox.

=======================
The code I'm using looks like this:

Private Sub cboFindLName_AfterUpdate()
On Error GoTo HandleErr

' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[UID] = " & Str(Me![cboFindLName])
Me.Bookmark = rs.Bookmark

...


If that does not fix the problem (apparently not), then I'm not sure what it
is. However, I would offer a suggestion that might help, regardless: It
looks like the bound column of your combo box is the last name field.
Assuming you have a numeric primary key field, use that instead, as the
combo box's bound value. As long as the last name is the first *displayed*
column, you still get the benefit of the Autoexpand, and you get a faster
and more reliable FindFirst:

rs.FindFirst "PrimaryKeyFieldName=" & Me!cboFindLName.Value

This *may* also fix your problem.


Your very kind input here gave me a clue to why the incremental search
feature only works sporadically: I failed to set the cbo object to
null after each search. All I needed to do was to insert the
following code after the last line above (Me.Bookmark = rs.Bookmark):

Me.cboFindLName = Null

That sets the unbound control to null so the next search is not
corrupted by the name found in the last search.

Thanks for your help! You're a prince.
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by One's Too Many | last post: by
2 posts views Thread by Mike | last post: by
reply views Thread by Jonathan LaRosa | last post: by
4 posts views Thread by Dave | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.