Fix so FindFirst works with Caps Lock On.

B

bw

Below is the event for a combo box.
If I enter the name with Caps Lock OFF, it works fine.
If I enter the name with Caps Lock ON, it doesn't work.
I'd like it to work whether Caps Lock is On or Off.

Private Sub lblBankName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveFirst
rs.FindFirst "[BankID] = " & Str(Me![lblBankName])
If rs.NoMatch Then
MsgBox "Record not found"
rs.MoveFirst
Me.lblBankName = [BankID]
Else
Me.Bookmark = rs.Bookmark
End If
End Sub


--
 
D

Douglas J. Steele

Given that Jet (the database engine used by Access) is case-insensitive, it
doesn't make sense that case should matter.

What exactly do you mean by "enter the name"? Are you talking about
selecting an entry in the list using the mouse, typing an entry that exists
in the list, or typing an entry that doesn't exist in the list? (I'm
assuming lblBankName is the name of your combo box)
 
B

bw

Yes, lblBankName is the name of the combo box.
I'm talking about typing an entry that exists in the list.

Assume the first name in the list, which has the focus, is "Bank One".
Also assume a bank name of "Finance Bank" in the list and "Fish Bank" is
also in the list.
I can type "fis" to go to the "Fish Bank" record.

But typing "FIS" (or even "FI") seems to cause the focus to go to the
the 3rd character of the first name in the list which matches the typed
input. So the resulting name in the box looks like this after each
character is typed:
F>Finance Bank
FI>Finance Bank
FIS>FiSance Bank.....The focus in now after the 3rd character, not on
the whole field.


Douglas J. Steele said:
Given that Jet (the database engine used by Access) is
case-insensitive, it doesn't make sense that case should matter.

What exactly do you mean by "enter the name"? Are you talking about
selecting an entry in the list using the mouse, typing an entry that
exists in the list, or typing an entry that doesn't exist in the list?
(I'm assuming lblBankName is the name of your combo box)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


bw said:
Below is the event for a combo box.
If I enter the name with Caps Lock OFF, it works fine.
If I enter the name with Caps Lock ON, it doesn't work.
I'd like it to work whether Caps Lock is On or Off.

Private Sub lblBankName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveFirst
rs.FindFirst "[BankID] = " & Str(Me![lblBankName])
If rs.NoMatch Then
MsgBox "Record not found"
rs.MoveFirst
Me.lblBankName = [BankID]
Else
Me.Bookmark = rs.Bookmark
End If
End Sub
 
D

Douglas J. Steele

I'm afaid I'm unable to reproduce your problem, so I can't offer any
suggestions.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


bw said:
Yes, lblBankName is the name of the combo box.
I'm talking about typing an entry that exists in the list.

Assume the first name in the list, which has the focus, is "Bank One".
Also assume a bank name of "Finance Bank" in the list and "Fish Bank" is
also in the list.
I can type "fis" to go to the "Fish Bank" record.

But typing "FIS" (or even "FI") seems to cause the focus to go to the the
3rd character of the first name in the list which matches the typed input.
So the resulting name in the box looks like this after each character is
typed:
F>Finance Bank
FI>Finance Bank
FIS>FiSance Bank.....The focus in now after the 3rd character, not on the
whole field.


Douglas J. Steele said:
Given that Jet (the database engine used by Access) is case-insensitive,
it doesn't make sense that case should matter.

What exactly do you mean by "enter the name"? Are you talking about
selecting an entry in the list using the mouse, typing an entry that
exists in the list, or typing an entry that doesn't exist in the list?
(I'm assuming lblBankName is the name of your combo box)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


bw said:
Below is the event for a combo box.
If I enter the name with Caps Lock OFF, it works fine.
If I enter the name with Caps Lock ON, it doesn't work.
I'd like it to work whether Caps Lock is On or Off.

Private Sub lblBankName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveFirst
rs.FindFirst "[BankID] = " & Str(Me![lblBankName])
If rs.NoMatch Then
MsgBox "Record not found"
rs.MoveFirst
Me.lblBankName = [BankID]
Else
Me.Bookmark = rs.Bookmark
End If
End Sub
 
B

bw

Well, it turns out that "my" problem has nothing to do with the
procedure I had shown. Instead, this seems like any combo box has the
same "problem".

Try this:
Make a Table1 with BankID (autonumber) and BankName (Text).
Enter three BankNames as follows:
1 Fisher Bank
2 Finance Bank
3 Financial Bank

Now make a form with an unbound combo box with a row source
SELECT Table1.FieldID, Table1.FieldValue
FROM Table1;

Now put the caps lock on and type FINANCE BANK in the combo box.
With the caps lock on, you cannot find the Finance Bank.

I know this is a minor problem, but I'd like to know how to avoid it, if
possible.



Douglas J. Steele said:
I'm afaid I'm unable to reproduce your problem, so I can't offer any
suggestions.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


bw said:
Yes, lblBankName is the name of the combo box.
I'm talking about typing an entry that exists in the list.

Assume the first name in the list, which has the focus, is "Bank
One".
Also assume a bank name of "Finance Bank" in the list and "Fish Bank"
is also in the list.
I can type "fis" to go to the "Fish Bank" record.

But typing "FIS" (or even "FI") seems to cause the focus to go to the
the 3rd character of the first name in the list which matches the
typed input. So the resulting name in the box looks like this after
each character is typed:
F>Finance Bank
FI>Finance Bank
FIS>FiSance Bank.....The focus in now after the 3rd character, not on
the whole field.


Douglas J. Steele said:
Given that Jet (the database engine used by Access) is
case-insensitive, it doesn't make sense that case should matter.

What exactly do you mean by "enter the name"? Are you talking about
selecting an entry in the list using the mouse, typing an entry that
exists in the list, or typing an entry that doesn't exist in the
list? (I'm assuming lblBankName is the name of your combo box)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Below is the event for a combo box.
If I enter the name with Caps Lock OFF, it works fine.
If I enter the name with Caps Lock ON, it doesn't work.
I'd like it to work whether Caps Lock is On or Off.

Private Sub lblBankName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveFirst
rs.FindFirst "[BankID] = " & Str(Me![lblBankName])
If rs.NoMatch Then
MsgBox "Record not found"
rs.MoveFirst
Me.lblBankName = [BankID]
Else
Me.Bookmark = rs.Bookmark
End If
End Sub
 
G

Guest

bw,

Did you ever find a fix to this, I am battling it also.

Steve

bw said:
Well, it turns out that "my" problem has nothing to do with the
procedure I had shown. Instead, this seems like any combo box has the
same "problem".

Try this:
Make a Table1 with BankID (autonumber) and BankName (Text).
Enter three BankNames as follows:
1 Fisher Bank
2 Finance Bank
3 Financial Bank

Now make a form with an unbound combo box with a row source
SELECT Table1.FieldID, Table1.FieldValue
FROM Table1;

Now put the caps lock on and type FINANCE BANK in the combo box.
With the caps lock on, you cannot find the Finance Bank.

I know this is a minor problem, but I'd like to know how to avoid it, if
possible.



Douglas J. Steele said:
I'm afaid I'm unable to reproduce your problem, so I can't offer any
suggestions.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


bw said:
Yes, lblBankName is the name of the combo box.
I'm talking about typing an entry that exists in the list.

Assume the first name in the list, which has the focus, is "Bank
One".
Also assume a bank name of "Finance Bank" in the list and "Fish Bank"
is also in the list.
I can type "fis" to go to the "Fish Bank" record.

But typing "FIS" (or even "FI") seems to cause the focus to go to the
the 3rd character of the first name in the list which matches the
typed input. So the resulting name in the box looks like this after
each character is typed:
F>Finance Bank
FI>Finance Bank
FIS>FiSance Bank.....The focus in now after the 3rd character, not on
the whole field.


message Given that Jet (the database engine used by Access) is
case-insensitive, it doesn't make sense that case should matter.

What exactly do you mean by "enter the name"? Are you talking about
selecting an entry in the list using the mouse, typing an entry that
exists in the list, or typing an entry that doesn't exist in the
list? (I'm assuming lblBankName is the name of your combo box)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Below is the event for a combo box.
If I enter the name with Caps Lock OFF, it works fine.
If I enter the name with Caps Lock ON, it doesn't work.
I'd like it to work whether Caps Lock is On or Off.

Private Sub lblBankName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveFirst
rs.FindFirst "[BankID] = " & Str(Me![lblBankName])
If rs.NoMatch Then
MsgBox "Record not found"
rs.MoveFirst
Me.lblBankName = [BankID]
Else
Me.Bookmark = rs.Bookmark
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top