search that works unless beginning with "I"

tonyk

New member
Local time
Today, 19:15
Joined
Mar 22, 2012
Messages
6
help please

I have a simple bit of code

that searches for a [User Name] field

the basic idea is I place a field called "search" on a form
and set its on change to

Private Sub Search_Change()
Search.SetFocus
strtarget = Search.Text
If strtarget < "a" Then strtarget = "a"
[User Name].SetFocus
DoCmd.FindRecord strtarget, acStart, False, acSearchAll, False, acCurrent, True

Search.SetFocus
Search.SelStart = 100
End Sub

it takes the text entered in the search field and calls it Strtarget
then resets focus on the field I want eg [user name]

once the search has done it resets the focus on the search field so you can carry on typing

this works very well unless the search string starts with a letter I
and I have no idea why this is happening

can anyone help ??
 
I use this idea in my apps

what does it do with an "I" when you use it?
 
I get a run time error 2110 dialog box

"Mobile cant move the focus to the control User name"

the Mobile is name of database

and the control is on the form and it does actually show the next record that starts with "I"

but its just the error message thati then have to click "end"
 
thanks for the reply
its not quite what Im after

the search does not either close or open a form
it simply shows the correct record on the current form

even if there is no record with a particular letter it still works and shows best match so far

I have tried it on various pc and laptops today in case its a particular setup but the fault happens on each pc

so still looking for a fix

regards
TK
 
Did you read post number 10?

It is the same issue that you are having; typing "I" leads to an error.

Read the whole thread.

Go to page 2 of the thread
 
Oh My Gosh Page 2

I missed that completely

and thank you very much that resolved my issue

many thanks
 
do you have code in the current event (or elsewhere) that might be trying to use control called "user name"?

is the control set with enabled = false?
 
No it was resolved it was only happening when it was a small case "i" and not when its a capital "I"
so just forced it to have capitals used and its now working fine

I have no idea why a small "i" should not work
 

Users who are viewing this thread

Back
Top Bottom