How do you enter Unicode characters without an Alt-nnnn shortcut? (1 Viewer)

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
I have a need to enter a range of non-English names into a combo box on a form in an Access 2003 application. Sometimes this requires the use of accented characters that do not appear on a UK keyboard. If I refer to the Windows XP Character Map facility (charmap.exe) then I can see that many foreign characters have been allocated an Alt-nnnn code that is displayed at the bottom right of the Character Map acreen. This makes it easy to enter such characters.

However, many other characters have not been given an Alt-nnnn keyboard shortcut. They only have a U-FFFF code, displayed at the bottom left of the Character Map screen. I've no idea what you are supposed to do with this U-FFFF code (where FFFF is a hexadecimal number), and the Help doesn't help. Any suggestions?

David
 

DCrake

Remembered
Local time
Today, 00:06
Joined
Jun 8, 2005
Messages
8,632
Simple Software Solutions

Hi

What you have got to remember is that you can only use the atl nnnn for characters of the same font. You cannot mix fonts in one string.

What you may want to try is to create a similar routine as your mobile phone when you want to add a specific character. Create a string with the possible characters and place them in a combobox and use copy and paste to or select button to copy the desired character over.

Code Master::cool:
 

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
Yes, I'm familiar (up to a point) with the font issue. Many fonts only appear to contain their unique subset of Unicode characters so you have to find the font that meets your requirements. In practice, you don't need all that many accented characters to cope with a wide range of eastern European surnames - but some of the ones I do need don't have a Alt-nnnn shortcut.

I have started to create a much reduced version of the Windows Character Map (similar to your idea) for easy selection of any special character when typing in a new name. However, I have not yet found how to force the insertion of the selected character into the current name or address field on my main form at the current position of the insertion cursor (I'm trying to avoid copy and paste). The ActiveControl property of the form will tell me which control is active but I don't yet know how to simulate typing in a character to that field. It's probably very simple. Any ideas?

BTW, I have found out that pasting a special character into a combo box does not trigger the AutoExpand property. In contrast, typing any valid Alt-nnnn code directly into a combo box will trigger AutoExpand. For this reason, I have created an additional surname field in my table that contains the unaccented equivalent of any accented character. Users can then use a combo box to quickly find any existing names. Elsewhere in the app I would normally display the accented version of the surnames.

David
 

Simon_MT

Registered User.
Local time
Today, 00:06
Joined
Feb 26, 2007
Messages
2,177
I would suggest have a Dialogue Form with a button(s) "Add Special Character" then select the special character and concatenate them either on the Dialogue Form or Entry Form. The problems arises when other fields need the same treatment and then knowing which Entry Form field to update. This could be handled by a Flag on the Dialogue Form denoting the Entry Forms source field.

Simon
 

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
But will concatentation work properly in this situation? Imagine that I have typed half a name in the Surname field on my main form. I now want to insert a special character via my CharMap popup form. Since I have not yet saved anything in the Surname field, would I not end up with only the special character in the name field?

Perhaps I have to force a save before any insertion.....

In addition, this concatenation method does not allow me to insert a special character in the middle of a name. How does VBA know the current position of the insertion cursor (or whatever Access calls it) in a text field or combo box?
 
Last edited:

Simon_MT

Registered User.
Local time
Today, 00:06
Joined
Feb 26, 2007
Messages
2,177
This is the method I would use, keeping in mind you need to control which field you have come out of that subsequently gets maintained:

Open Character Dialogue Form from Surname Radio Button
Character Dialogue Form Source = "S"
Character Dialogue Form Text = Entry Form Surname
After Character Selection
Character Dialogue Form Text = Character Dialogue Form Text + SpecialCharacterCombi

On Close
If Character Dialogue Form Source = "S" then
Entry Form Surname = Character Dialogue Form Text

or simply don't reference Character Dialogue Form Text but after Update of SpecialCharacterCombi
Entry From Surname = Entry Form Surname + Character Dialgoue Form SpecialCharacterCombi.

Simon
 

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
Simon,
Many thanks for the assistance but I don't think that your suggestion addresses the question of the partially typed surname not having been saved yet. Nor does it appear to let you insert a special character in the middle of any text currently in the Surname field.

I also posted a similar question on another Access forum and have just received the following reply, which looks like it may offer the route to a total solution of my problem, though I have yet to put it to the test.

"SelStart will tell you where the cursor is in the control.
SelLength will tell you how many characters are selected.

Make sure you use the Text property of the control: it's Value may not be up
to date yet.

Since these values are integers, this won't work with memos that have > 32k
characters".

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.​
 

Simon_MT

Registered User.
Local time
Today, 00:06
Joined
Feb 26, 2007
Messages
2,177
This is my understanding, if you reference the Form i.e. Forms![Entry Form]![Surname] you are refering to the Form not the recordset. I don't mind being corrected if I'm wrong. The point about a Dialogue Form is that your Entry From is not closed and by not Saving the Record you are in effect intercepting the input. By saying:

Form![Entry Form]![Surname] = Forms![Entry Form]![Surname] + etc the field should be concatenated. I accept that this only works on the next character to be inputtted rather than somewhere within an existing record.

Simon
 

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
Simon,
I'm no guru, but I think that referencing the field Form![Entry Form]![Surname] will give you a null result unless it is bound to a table or has been given a value by your VBA code or by a previous user entry. This is why Allen Browne was bringing my attention to the Text property, which stores what has been typed so far in the field but not yet stored in the Value property.

I think the user has to do something like hitting the Enter key or moving focus to another field on the form before the Surname field will actually store what the user has typed.

When I attempt to implement this feature tomorrow I will find out if I have the correct understanding....

David
 

Simon_MT

Registered User.
Local time
Today, 00:06
Joined
Feb 26, 2007
Messages
2,177
Neither am I I'm a suck it and see type, but to Test this, which I have tried, try creating a Form (TestForm) with one Field (TestText) enter some incomplete Text in your Entry Form (I'm assuming Surname) and with a Button Open TestForm

With CodeContextObject = Me in a subroutine

Code:
Function TestForm()

    With CodeContextObject
        DoCmd.OpenForm "TestForm", acNormal, "", "", , acNormal
        Forms![TestForm]![TestText] = .[Surname]
    End With
End Function

Simon
 

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
Hi Simon,
Your test example works perfectly but I suspect that this is because I had to move the focus to the test button that opened TestForm. Moving focus elsewhere will cause whatever is in the Surname field to be saved (see below). If focus remains in the Surname field then my understanding is that you have to use the Text property to find what's in it at that point.

This is all new stuff for me so I checked the Access 2003 Help file, which says,
While the control has the focus, the Text property contains the text data currently in the control; the Value property contains the last saved data for the control. When you move the focus to another control, the control's data is updated, and the Value property is set to this new value. The Text property setting is then unavailable until the control gets the focus again. If you use the Save Record command on the Records menu to save the data in the control without moving the focus, the Text property and Value property settings will be the same.​

David
 

Simon_MT

Registered User.
Local time
Today, 00:06
Joined
Feb 26, 2007
Messages
2,177
Out of curiosity I will test it later to see what happens! You are probably right.

Simon
 

David Anderson

Registered User.
Local time
Today, 00:06
Joined
Nov 18, 2007
Messages
84
BTW, thanks for making me aware of CodeContextObject. That might come in useful on some future occasion.

David
 

Users who are viewing this thread

Top Bottom