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

Chapter 12. Advanced Query Concepts > Using the Result of a Function as the Cri...

Using the Result of a Function as the Criteria for a Query

Many people are unaware that the result of a function can serve as an expression in a query or as a parameter to a query. The query shown in Figure 12.38 evaluates the result of a function called Initials. The return value from the function is evaluated with criteria to determine whether the employee is included in the result. The Initials function shown below (it's also in the basUtils module of CHAP12EX.MDB, found on the sample code CD-ROM) receives two strings and returns the first character of each string followed by a period:

Function Initials(strFirstName As String, _
      strLastName As String) As String
   Initials = Left(strFirstName, 1) & "." & _
      Left(strLastName, 1) & "."
End Function


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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