Results 1 to 3 of 3
  1. #1
    Mbakker71 is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    20

    find last object by spliting string

    Hello,

    i've a code that can split strings. but now i want the last thing he split in a string named "name".



    the string what is split is folder places like C:\Users\inengine@mccain.com\Documents\Test\van\te st.txt.

    now i want that text.txt comes in 'name'

    who can help me?

    martijn

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Can post post your code?

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    DisplayValue: right([Fieldname], len([fieldname]) - (instrrev([Fieldname], "\") + 1))

    if you're doing it in a query


    dim sDisplayValue

    sDisplayValue = right([Fieldname], len([fieldname]) - (instrrev([Fieldname], "\") + 1))

    if you're doing it in code

    the key here is using a combination of the LEN and INSTRREV functions innate to Access

    Len gives you the length of a string
    INSTRREV finds the first instance of a string starting at the END of the string
    INSTR finds the first instance of a string starting at the BEGINNING of the string

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

Similar Threads

  1. Using Variable String to Set a Form object
    By neo651 in forum Programming
    Replies: 17
    Last Post: 07-08-2013, 12:59 PM
  2. can't find object
    By slimjen in forum Forms
    Replies: 1
    Last Post: 03-29-2013, 12:23 PM
  3. RunMacro cannot find submacro object.
    By weasel7711 in forum Programming
    Replies: 2
    Last Post: 09-05-2012, 01:16 PM
  4. Replies: 1
    Last Post: 09-03-2011, 07:01 PM
  5. cant find the object
    By AccessLes in forum Forms
    Replies: 1
    Last Post: 06-30-2010, 12:41 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