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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Case 1

Status
Not open for further replies.

gavinjb

Programmer
Apr 24, 2003
106
GB
Hi,

I need to Convert the Case in all fields on My database to UpperCase when the User Leaves the Field, I have written a simple Procedure which uses the strConv Function, but what ever If conditions I use I can't get it to only run if the field has been changed or if the field has been previously Null.

I have managed to get it to Convert case if the Value in the Field has just changed, my problem is though on any conditions I give it for Null Values, it does not seem to work or it just keeps running when every you leave the field and there by locks the field.
 
I don't understand your question, perhaps post the code? If it is regarding how to test different conditions

You could try the IsNull function AND a test for "", or try the "multipurpose"

[tt]if len(Me!txtSomeControl.Value & vbNullstring) = 0 Then[/tt]

For change of value, you might consider using the .OldValue property:

[tt]if Me!txtControl.Value <> Me!txtControl.OldValue Then[/tt]

Roy-Vidar
 
Create an UpperCase function in a module:
Code:
Function UpperCase(strOneLine As String)

    strOneLine = UCase$(strOneLine)
    
    UpperCase = strOneLine

End Function

Add code like this to the After Update event of each field you want to convert to upper case:
Code:
Private Sub MyField_AfterUpdate()
    Me.MyField = UpperCase(Me.MyField)
End Sub

This should work with no problems.


Bob Stubbs
 
Why not just use a format of ">"? It shouldn't really matter how the data is stored in the table.

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top