• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 16. Overcoming the Limitations o... > Using Functions with Queries, Revisi...

Using Functions with Queries, Revisited

Sometimes, obstacles are thrown at you for which you are not prepared. Suppose that a client sent you a list of names that was input by two temps. The first temp liked to type everything in uppercase. The second temp typed everything in a combination of upper- and lowercase. After sorting and adding your own primary key, the records were shuffled like a deck of cards. Your boss wants you to find all the records that are uppercase and change them so that the first letter is uppercase and all subsequent letters are lowercase. The following function is Boolean. As you already discovered, the Boolean data type is either true or false.

Function ChkUpper(strField As String) As Boolean 
Dim i As Integer, chk As String 

For i = 1 To Len(strField) 
chk = Mid(strField, i, 1) 
    If Asc(chk) >= 32 And Asc(chk) < 97 Then 
        ChkUpper = True 
    Else 
        ChkUpper = False 
        Exit For 
    End If 
Next i 

End Function 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint