Replace / with ~ if date found in string

chris-uk-lad

Registered User.
Local time
Today, 09:37
Joined
Jul 8, 2008
Messages
271
Hi all,

Tried finding a solution in this site but couldnt find one for searching a string for a specified character (if you see one, link me :x)

Im searching through a column to create folders based on a field value. At a point i come across a field value that contains a date, so i wish to find the values that contain a date, and when found, replace the / with ~ to allow me to create.

e.g
James 01/01/01
James 01~01~01

Atm im using the code

Code:
  Do Until Name.EOF
        count = 1
        MkDir strTempFilePath & "\" & Name![aName]
jumpin1:
        Name.MoveNext
    Loop
 
getting closer but i hit a problem :(

Code:
        If InStr(Name![aName], "/") Then
        Name![aName] = Replace(Name![aName], "/", "~")
        End If
        MkDir strTempFilePath & "\" & Name![aName]
What problem did you hit? The more relevant info you can give the easier it is for you to get help.
 
getting closer but i hit a problem :(

Code:
If InStr(Name![aName], "/") Then
        Name![aName] = Replace(Name![aName], "/", "~")
        End If
        MkDir strTempFilePath & "\" & Name![aName]
 
sorry, i ninja edited the above as i had put solved prematurely.

The error is database object is read only, which i dont get as the database is not read only :x i figure its going to change the value in the foeld first before creating the folder so guess at a database issue?

also might a sort of count be needed to work through the characters?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom