Results 1 to 3 of 3
  1. #1
    Naded is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    5

    Find position of an letter in an alpha numeric string

    I have a column that contain records, each made up of letters and numbers in no particular order. I will like to determine the position of the second letter in a record. I am aware of the Instr() function but I haven't got a clue of what the search criteria should be. Any help will be grateful? Thanks


    e.g 12F34567D89101. What is the position of the D

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Here's a function that will return the position.

    Code:
    Public Function fcnFindSecond(arg As String) As Long
        Dim i As Integer
        Dim j As Integer
        Dim k As Integer
        j = Len(arg)
        For i = 1 To j
        If Not IsNumeric(Mid(arg, i, 1)) Then
            k = k + 1
                If k = 2 Then
                    fcnFindSecond = i
                    Exit Function
                End If
        End If
        Next i
    End Function

  3. #3
    Naded is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    5
    Thank you Sir. it work great

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DMax +1 a field with alpha and numeric characters
    By beewerks in forum Programming
    Replies: 6
    Last Post: 02-12-2018, 05:06 PM
  2. creation alpha numeric code
    By Jen0dorf in forum Access
    Replies: 1
    Last Post: 05-09-2016, 11:52 AM
  3. Replies: 1
    Last Post: 03-09-2014, 06:30 PM
  4. Alpha Numeric auto id?
    By arshadmgic in forum Forms
    Replies: 7
    Last Post: 09-02-2012, 03:00 AM
  5. Find first Capital letter in string
    By Dutch1956 in forum Programming
    Replies: 5
    Last Post: 09-07-2011, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums