UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Returning Part Of A String, Access 2016    
 
   
M2C
post Aug 10 2018, 12:11 AM
Post#1



Posts: 664
Joined: 7-April 08
From: Dubai


Hi
I have Public Function that works well for getting the right hand side of a string

The string is: "C:\Users\Chris\OneDrive\Documents\Core\MF\City Centre\Test Sheets\AHU's\AHU.xlsx"

CODE
'C/O @JonSmith
Public Function splitme(strurl As String) As String
splitme = Split(strurl, "\MF\")(1)
End Function


When I use the above in a query for the field [URL] i.e. Expr1:splitme([URL]) I get:

City Centre\Test Sheets\AHU's\AHU.xlsx

However I would like to return everything before "\MF\" i.e.
C:\Users\Chris\OneDrive\Documents\Core

Any ideas?

Thanks
Chris
Go to the top of the page
 
RJD
post Aug 10 2018, 12:30 AM
Post#2


UtterAccess VIP
Posts: 9,240
Joined: 25-October 10
From: Gulf South USA


Hi Chris: Try (0) as the first element of the array, instead of (1).

Or, as an alternative, you can use a combination of Left and Instr.

HTH
Joe
Go to the top of the page
 
M2C
post Aug 10 2018, 12:34 AM
Post#3



Posts: 664
Joined: 7-April 08
From: Dubai


Brilliant! Many thanks Joe
Go to the top of the page
 
RJD
post Aug 10 2018, 12:40 AM
Post#4


UtterAccess VIP
Posts: 9,240
Joined: 25-October 10
From: Gulf South USA


thumbup.gif
Go to the top of the page
 
JonSmith
post Aug 10 2018, 02:38 AM
Post#5



Posts: 3,986
Joined: 19-October 10



Appreciate the C/O there M2C, I remember helping you on that!
Glad RJD was able to quick fix getting the first half!
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    12th December 2018 - 03:59 PM