Re: Control = StrConv([Control], 3)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I will give it a shot and post back...thanks in advance!

-----------------
Scott



"fredg" wrote:

> On Fri, 29 Jul 2005 11:34:04 -0700, Scotts wrote:
>
> > Thank you both for your input.
> >
> > Fred- I think a list of exceptions would be best, I can only see a handful
> > of these...I look forward to your coding.
> >
> > -----------------
> > Scott
> >
> > "fredg" wrote:
> >
> >> On Fri, 29 Jul 2005 07:03:05 -0700, Scotts wrote:
> >>
> >>> How can I tell the macro to not format a word if it is already capitalized?
> >>>
> >>> This macro works create if I enter a simple street name, however, if I want
> >>> and enter, say US Hwy 32, it will format it as Us Hwy 32. Would this maybe
> >>> require an if then statement or something?
> >>>
> >>> -----------------
> >>> Scott
> >>
> >> It's doing what it's supposed to do.
> >>
> >> What you can do is create a table of exceptions, and DLookUp each word
> >> in the field to see if it is one of the exceptions. Requires a bit of
> >> coding in the Address control's AfterUpdate event.
> >> It would also require you to continuously update the table as new
> >> multi-capital words are run across.
> >> If you need help with this, post back.
> >>
> >> --
> >> Fred
> >> Please only reply to this newsgroup.
> >> I do not reply to personal email.
> >>
>
> Add a new table to your database.
> Add 2 fields.
> 1 [ID] Autonumber Indexed No duplicates
> 2 [ExceptName] Text Datatype 255 chrs
> Name the table 'tblExceptions'
>
> Copy and Paste the following code into a Module:
>
> *** Watch out for word wrap on the longer lines. ***
>
> Function ConvExceptionsInField(StrIn As String) As String
>
> ' Will find exceptions to Proper Case capitalization of names.
> ' In a multi-word string
> On Error GoTo Err_Handler
>
> Dim strWord As String
> Dim intX As Integer
> Dim intY As Integer
> Dim strNewString As String
> Dim intResponse As Integer
> Dim strFind As String
>
> StrIn = StrIn & " "
>
> intX = InStr(1, StrIn, " ")
> strWord = StrConv(Mid(StrIn, intY + 1, intX - 1), vbProperCase)
>
> Do While intX <> 0
>
> If DCount("*", "tblExceptions", "[ExceptName]= " & Chr(34) & strWord &
> Chr(34) & "") > 0 Then
>
> strFind = DLookup("[ExceptName]", "tblExceptions", "[ExceptName] =
> " & Chr(34) & strWord & Chr(34) & "")
>
> intResponse = MsgBox(strFind & vbCrLf & " is an exception name." &
> vbCrLf & " Accept the above capitalization? Y/N ?", vbYesNo,
> "Exception found!")
>
> If intResponse = vbYes Then
> strWord = strFind
> End If
> End If
> strNewString = strNewString & strWord & " "
> intY = intX + 1
> intX = InStr(intY, StrIn, " ")
> strWord = StrConv(Mid(StrIn, intY, intX - intY), vbProperCase)
>
> Loop
>
> ConvExceptionsInField = strNewString
> Exit_this_Function:
> Exit Function
> Err_Handler:
> Resume Next
> End Function
>
> ===============
>
> Then code the AfterUpdate event of the control (named Address in this
> example) used for address entry on your form:
>
> If Not IsNull([Address]) Then
> [Address] = ConvExceptionsInField([Address])
> End If
>
> Then enter the exception names into the table as you come across them,
> i.e. McDonald, US, IBM, O'Connor, etc.
>
> As you enter addresses, if a word is found in the table, yow will get
> a message asking whether to retain the entered capitalization or
> change it. As you find a new words, add them to the table.
>
> --
> Fred
> Please only reply to this newsgroup.
> I do not reply to personal email.
>
.



Relevant Pages

  • Re: Exception.ToString()
    ... I use this article for reference on Exceptions: ... For example if I add the string to the Resources page of the project ... Dim s As String = My.Resources.Exception_EndOfInnerExceptionStack ... I normally group my resources into common resource files. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: macro to save as
    ... "Scott Vincent" wrote: ... >> Dim Response As String ...
    (microsoft.public.excel.programming)
  • RE: macro to save as
    ... "C4" is a locked cell. ... >>> Dim Response As String ...
    (microsoft.public.excel.programming)
  • Re: SQL query... is there a better way?
    ... Scott ... > Personally I would use a parameterized query, ... > Dim paramList As New StringBuilder ... > Dim paramName As String ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Control = StrConv([Control], 3)
    ... > Fred- I think a list of exceptions would be best, I can only see a handful ... Function ConvExceptionsInField(StrIn As String) As String ... Dim strWord As String ... Dim intY As Integer ...
    (microsoft.public.access.formscoding)