Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return value from a function. 1

Status
Not open for further replies.

Razor1

IS-IT--Management
Nov 21, 2002
81
US
I need to have fields on a form to all be upper case and saved to the table in upper case.

I created the following function:

Function UpperCase(Name As String) As Variant
On Error GoTo PROC_ERR
Dim strName As String
strName = Name
Name = UCase(strName)
PROC_EXIT:
Exit Function
PROC_ERR:
MsgBox Err.Description
Resume PROC_EXIT
End Function

I want to call it from the OnExit of the field on the screen.

I have entered = Uppercase(fieldname) in the OnExit of the field I would like to have as upper case.

Can anyone tell what I am doing wrong?
 
Seems like a lot of trouble for this. Why not just use

Private Sub txtField_Exit(Cancel As Integer)
txtField.Value = UCase(txtField.Value)
EndIf

It works, and its much less code.

-Pete
 
And why not simply have an InputMask set to > ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top