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

Chapter 11. Advanced Query Techniques > Using the Result of a Function as the C...

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 11.39 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 query result. The Initials function shown here (it's also in the basUtils module of CHAP11EX.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