ACC2000: Function to Reverse String Characters in a QueryID: Q210439
|
Microsoft Access 2000 includes a new function, StrReverse(), that returns a string with the characters reversed from the original argument string. For example, if you were to pass the string "ABCD" to the function, the function would return the string "DCBA."
This article shows you how to create a function called ReverseString() that uses the StrReverse() function, so that you can sort records in a query with the results of the function.
NOTE: You will receive the following error message if you use the StrReverse() function directly in a query.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:Undefined function 'StrReverse' in expression.
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.aspThe following example demonstrates how to create and use the ReverseString() function:
Option Explicit
Function ReverseString (MyString As String)
ReverseString = StrReverse(MyString)
End Function
Query: Query1
-------------------------------------------
Field: CategoryName
Show: (selected)
Field: Expr1: ReverseString([CategoryName])
Sort: Ascending
Show: (not selected)
CategoryName
------------
Seafood
Produce
Beverages
Grains/Cereals
Confections
Dairy Products
Condiments
Meat/Poultry
Additional query words: inf sorting backwards sample function
Keywords : kbprg kbdta AccCon KbVBA
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 6, 1999