Access VBA: Code to identify character postion within a string.

Posted on 2012-08-24
Last Modified: 2012-08-24
I need to identify where a "." is within a string i.e.2nd, 3rd, 4th position etc.  I could use nested if statements but I'm looking for something more efficient and cleaner.
Question by:JAMES125
    LVL 3

    Accepted Solution

    How about Instr
     instr(" is",".") gives u 5 the position of "."
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    Well, the Instr( ) function designed for that.

    But what is your actual purpose?  Are you really concerned with where the periods/decimal points are, or are they just delimiters, and what you really need is to find out the information between the periods.  If the latter, then you need to look into the Split( ) function, which accepts a string and a delimiter and returns an array of values broken into segments around the delimiter.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now