Results 1 to 5 of 5
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    Return text value in a string

    Hi Guys



    im using the code below to get the position of a "*" in a text filed, this is working great and returns the correct value of 15 for this text NI PL CU STR19*

    Dim LPosition As Integer
    LPosition = InStr(Forms!SOIAddDetails.Form.PartNumberDescripti onTXTBox, "*")

    what i would like to do is this

    how do i actually get the text value of the character 1 place to the left of "*" in this case 9

    this value will be used in a calculation

    is possible?

    Kind regards

    Steve

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Is this always one position to the left?
    And if you want to use it in calculation you'll need its numeric value, not text value.

    Dim LPosition As Integer
    Dim NumberPosition As Integer
    Dim YourCharactersValue as Integer

    LPosition = InStr(Forms!SOIAddDetails.Form.PartNumberDescripti onTXTBox, "*")
    NumberPosition=LPosition-1
    YourCharactersValue=Val(Mid(
    Forms!SOIAddDetails.Form.PartNumberDescriptionTXTB ox, NumberPosition, 1))


  3. #3
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Mate

    Yes the required figure is always 1 to the left

    will give that a go
    Many thanks

    Steve

  4. #4
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Mate

    Many Thanks that was brill
    Steve

  5. #5
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Happy to help

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

Similar Threads

  1. Replies: 6
    Last Post: 05-29-2015, 10:21 AM
  2. How do I return last character in a string?
    By SSgtBarry in forum Queries
    Replies: 4
    Last Post: 06-22-2014, 08:10 PM
  3. Replies: 3
    Last Post: 06-11-2014, 08:06 AM
  4. Return text after a string
    By Madmartigan in forum Queries
    Replies: 11
    Last Post: 03-04-2014, 03:20 PM
  5. Replies: 6
    Last Post: 01-21-2014, 06:39 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