Replace part of the string

mischa

Registered User.
Local time
Today, 08:53
Joined
Jul 25, 2013
Messages
63
Code:
    Dim SourceSubFrmParts As String
    SourceSubFrmParts = subfrmEmptyParts.SourceObject

I would like to extract a part of the string which is assigned to SourceSubFrmParts and replace it with something else. The first six letters, which always will be 'subfrm', which in all cases have to be replaced with 'qry'.

Thanks in advance !
 
If what you described is correct (I find a lot of people don't fully understand what the word 'always' actually means), I would use the Mid function (http://www.techonthenet.com/access/functions/string/mid.php) to get all the characters after the 6th position and then concatenate that with the string 'qry'.

="qry" & Mid(SourceSubFrmParts, 6)
 
I have no idea WHY you're doing what you're doing, but you want the Left() Mid() and Right() functions... probably just the first two, in this case.
 
How about:

SourceSubFrmParts = Replace(SourceSubFrmParts , "subfrm", "qry")

Wayne
 
Thank you all for answering!
I used the Replace statement and the code is now working perfectly!

I wish you all a great 2014!
 

Users who are viewing this thread

Back
Top Bottom