skip code

J

Josh

Is there a way to skip code, here is an example of what I mean:

Say you have a LastName field, and use Proper to convert smith to
Smith. But, I want user to have option of using key combination or
whatever to be able to type in MacDonald and not have afterupdate code
change it to Macdonald.

The name example was only an example, I realize that Data Entry people
are keying in at a fast rate and that would actually slow them down.

My question is really just for general purpose, I've wondered from
time to time whether something like that is possible

Thanks, Josh
 
F

fredg

Is there a way to skip code, here is an example of what I mean:

Say you have a LastName field, and use Proper to convert smith to
Smith. But, I want user to have option of using key combination or
whatever to be able to type in MacDonald and not have afterupdate code
change it to Macdonald.

The name example was only an example, I realize that Data Entry people
are keying in at a fast rate and that would actually slow them down.

My question is really just for general purpose, I've wondered from
time to time whether something like that is possible

Thanks, Josh

Yes.
Add a table to the database of name exceptions that you MAY want to
use.
Then code the AfterUpdate event of the control to DLookUp the table
and show a message that that name may be an exception. Allow the user
to choose to change or not change the capitalization.


Make a new table.
Field: [ID] AutoNumber Indexed No Duplicates
Field: [ExceptName] Text datatype
TableName: tblExceptions

Enter as many known name exceptions as you can.
Note that hyphenated names, i.e. Smith-Jones, should also be added

====
Paste this function into a new module.

Public Function ConvExceptions(StringIn As String) As String

' Will find exceptions to Proper Case capitalization of names.
On Error Resume Next

If DCount("*", "tblExceptions", "[ExceptName] = " & Chr(34) & StringIn
&
Chr(34) & "") > 0 Then
Dim intResponse As Integer
Dim strFind As String
strFind = DLookup("[ExceptName]", "tblExceptions", "[ExceptName] =
" &
Chr(34) & StringIn & Chr(34) & "")

intResponse = MsgBox(strFind & vbCrLf & " is an exception name." &
vbCrLf _
& " Accept the above capitalization? Y/N ?", vbYesNo, "Exception
found!")

If intResponse = vbYes Then
ConvExceptions = strFind
Exit Function
End If
End If

ConvExceptions = StrConv(StringIn, 3)

End Function
======

Use it in a Control's AfterUpdate event:

If Not IsNull([ThisField]) Then
[ThisField] = ConvExceptions([ThisField])
End If


Add new names to the exceptions table as they occur.

Also remember that there are multiple correct capitalizations of
names,
O'Connor and O'connor are both correct, depending upon the individual,
and some words can be capitalized or not, depending upon usage i.e.
"The city's main street is Main Street."
 

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