Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    Unanswered: Automatically reverse contents of a field in Microsoft Access 2007

    I am using Microsoft Access 2007 and I want to convert this simple VBA program that reverses a cell’s contents in Excel so that it can be used in Access to reverse the contents of a field:

    Code:
    Public Function Rev(Rcell As Range, Optional IsText As Boolean)
        Dim i As Integer
        Dim StrNewNum As String
        Dim strOld As String
    
        strOld = Trim(Rcell)
    
        For i = 1 To Len(strOld)
            StrNewNum = Mid(strOld, i, 1) & StrNewNum
        Next i
        
        If IsText = False Then
            Rev = CLng(StrNewNum)
        Else
            Rev = StrNewNum
        End If
    End Function
    Please will someone advise me how to do this? You can probably tell that I am a complete beginner as far as using Access in this way.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    No need - Access VBA has this inbuilt:
    Code:
    ?strreverse("stooP evoL eW")
    Quote Originally Posted by Access VBA
    We Love Poots
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    Thank you

    I had no idea it was that simple!

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Nor did I
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    ?strreverse("); sb00n yb dednuorrus m'I - dog raed")
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •