Combo Boxes

M

Morag Mitchell

I am using a combo box to search for data on a form, created originally using
the wizard. It works with all non-accented characters, but a problem arises
when I type into the combo box a character without an accent when searching
for a character with an accent. Is there any way that I can instruct Access
to ignore the accents as I am not always aware whether an accent has been
used or not in the original data. The current code in the event procedure is:

Dim rs As Object
If Me.Combo206 <> "" Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[SYSID] = " & Str(Me![Combo206])
Me.Bookmark = rs.Bookmark
End If
 
A

Al Campagna

Morag,
I think you just need to base the combo on the actual data that's in your table.
Use the actual data from the records your searching to feed the combo through the
underlying query.
So, if there is a record with an accented value in your recordset, it will appear (with
the accent) as a possible choice in your combo... and will match exactly.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
M

Morag Mitchell

Thanks for the reply, but this is not the solution to my problem. My
question was obviously less than clear, sorry about that. I need to be able
to type the character into the combo box without an accent, but for the data
to be found whether it has an accent or not. As soon as I type the character
without the accent, equivalent characters with an accent are eliminated from
the combo box list, which means that if the accented character is the 2nd or
3rd letter, the only solution is to scroll down a potentially long list. Is
there a solution to this?

--
Many thanks

Morag Mitchell


Al Campagna said:
Morag,
I think you just need to base the combo on the actual data that's in your table.
Use the actual data from the records your searching to feed the combo through the
underlying query.
So, if there is a record with an accented value in your recordset, it will appear (with
the accent) as a possible choice in your combo... and will match exactly.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Morag Mitchell said:
I am using a combo box to search for data on a form, created originally using
the wizard. It works with all non-accented characters, but a problem arises
when I type into the combo box a character without an accent when searching
for a character with an accent. Is there any way that I can instruct Access
to ignore the accents as I am not always aware whether an accent has been
used or not in the original data. The current code in the event procedure is:

Dim rs As Object
If Me.Combo206 <> "" Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[SYSID] = " & Str(Me![Combo206])
Me.Bookmark = rs.Bookmark
End If
 
A

Al Campagna

Morag,
OK... give me an idea of the scope of the problem...
How many different accented characters are involved? (4-5?)
Do you know ahead of time that you'll be looking for an accented character in the
search string?

I'll assume Arial font for this example. Determine the ascii for the special
characters in your font...

IF... let's say... there are 5 characters involved. You could place 5 small buttons
on the form, right near the combo, with each button representing an accented character.
Say button1 caption = é (ascii 0233) (entered by Alt-0233)
In the combo you type "abcd", then you click button1, and a é is added to the "abcd"
string in the combo
cboYourCombo= FirstName & Chr(233)
cboYourCombo.SetFocus
cboYourCombo.SelStart = Len(FirstName)
What we're doing is creating a mini- keyboard to allow easy entry of those accented
characters into the search string.

If you don't know whether you're looking for a string with or without accents...
you're in big trouble. Searching all the permutations would pobably be prohibitive at
least, and error prone at best.
In that case I would look to "normalize" the data to all non-accent or no accents.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Morag Mitchell said:
Thanks for the reply, but this is not the solution to my problem. My
question was obviously less than clear, sorry about that. I need to be able
to type the character into the combo box without an accent, but for the data
to be found whether it has an accent or not. As soon as I type the character
without the accent, equivalent characters with an accent are eliminated from
the combo box list, which means that if the accented character is the 2nd or
3rd letter, the only solution is to scroll down a potentially long list. Is
there a solution to this?

--
Many thanks

Morag Mitchell


Al Campagna said:
Morag,
I think you just need to base the combo on the actual data that's in your table.
Use the actual data from the records your searching to feed the combo through the
underlying query.
So, if there is a record with an accented value in your recordset, it will appear
(with
the accent) as a possible choice in your combo... and will match exactly.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Morag Mitchell said:
I am using a combo box to search for data on a form, created originally using
the wizard. It works with all non-accented characters, but a problem arises
when I type into the combo box a character without an accent when searching
for a character with an accent. Is there any way that I can instruct Access
to ignore the accents as I am not always aware whether an accent has been
used or not in the original data. The current code in the event procedure is:

Dim rs As Object
If Me.Combo206 <> "" Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[SYSID] = " & Str(Me![Combo206])
Me.Bookmark = rs.Bookmark
End If
 

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

Similar Threads


Top