Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:20 PM
RIck
Guest
 
Posts: n/a
Default Error on Form with VBA

I have an error on a webpage of mine since I added a function to save
the data in Proper Case-- but a smarter proper case. The page is not
displayed so I don't know where the error is or how to fix it
(obviously.) Here is the code:

Function MakeProper(var)

If Len(var) > 0 then

strV = var
bCaps = True

For i = 1 To Len(strV)
Select Case UCase(Mid(strV, i, 2))
Case " A"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 2)) &
LCase(Mid(strV, i + 2))
i = i + 2
End Select

Select Case UCase(Mid(strV, i, 3))
Case " DL", " HR", " BB", " OK"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 3)) &
LCase(Mid(strV, i + 3))
i = i + 3
End Select

Select Case UCase(Mid(strV, i, 4))
Case " MLB", " NFL", " RBI"
bCaps = False
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 4)) &
LCase(Mid(strV, i + 4))
i = i + 4
End Select

If bCaps = True Then
strV = Left(strV, i - 1) & UCase(Mid(strV, i, 1)) &
LCase(Mid(strV, i + 1))
End If

If i <= Len(strV) Then
Select Case Asc(Mid(strV, i, 1))
Case 32, 45, 46, 47, 95
bCaps = True
Case Else
bCaps = False
End Select
End If
Next i

MakeProper= strV
else
MakeProper= var
end if
i = 0
End Function
  #2  
Old July 19th, 2005, 02:20 PM
RIck
Guest
 
Posts: n/a
Default Re: Error on Form with VBA

bluesbrthr@home.com (RIck) wrote in message news:<45f0255d.0407211758.71471b0a@posting.google. com>...[color=blue]
> I have an error on a webpage of mine since I added a function to save
> the data in Proper Case-- but a smarter proper case. The page is not
> displayed so I don't know where the error is or how to fix it
> (obviously.) Here is the code:
>[/color]

I should also add that the code works in MS Access after some minor
modifications. That's where I originally created the code.
  #3  
Old July 19th, 2005, 02:28 PM
RIck
Guest
 
Posts: n/a
Default Re: Error on Form with VBA

ok, thanks for you help everyone... ;)

The problem was the line "next i" I had to change it to "next". It's
possible there were other problems, but if there were I didn't catch
them as I fixed it.

bluesbrthr@home.com (RIck) wrote in message news:<45f0255d.0407220332.538d35bc@posting.google. com>...[color=blue]
> bluesbrthr@home.com (RIck) wrote in message news:<45f0255d.0407211758.71471b0a@posting.google. com>...[color=green]
> > I have an error on a webpage of mine since I added a function to save
> > the data in Proper Case-- but a smarter proper case. The page is not
> > displayed so I don't know where the error is or how to fix it
> > (obviously.) Here is the code:
> >[/color]
>
> I should also add that the code works in MS Access after some minor
> modifications. That's where I originally created the code.[/color]
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles