ProperCase problem

  • Thread starter Thread starter Birgit via AccessMonster.com
  • Start date Start date
B

Birgit via AccessMonster.com

Hi!

I have a problem with ProperCase. My code is following:

Public Function Aa(strToChange As String) As String
Aa = StrConv(strToChange, vbProperCase)
End Function

This works properly with text in the text box but with no text the result is
#Error. Is there another way to convert text?

Thanks for advance
Birgit
 
If I understand you correctly, the problem is with blank or null textboxes.
Try using this:

Public Function Aa(strToChange As String) As String
Aa = StrConv(nz(strToChange," "), vbProperCase)
End Function

John
 
J_Goddard said:
If I understand you correctly, the problem is with blank or null textboxes.
Try using this:

Public Function Aa(strToChange As String) As String
Aa = StrConv(nz(strToChange," "), vbProperCase)
End Function

John

A little modification and it works! I left the original VBA code as it is. I
put the Aa-function into the textbox an placed the Nz function in it:

=Aa(Nz([TextBoxName];" "))

Birgit
 
Back
Top