take the contents of a textbox and enter a character 4 positions from the end
Posted on 2005-03-14
I've got a filepath which is in a textbox - G:\database.mdb
I am doing a 'compact database' function which takes the database path name from the contents of the textbox, compacts the database and then renames it.
I want it to rename it to the same as the original file, but with the addition of 'TC' at the end of the filename.
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= """ & textbox1.Text & """ ", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= """ & textbox1.Text & "TC" & """ ;Jet OLEDB:Engine Type=5")
The code above works fine, except that it adds the 'TC' after the extention.
I.e: textbox1.text = G:\database.mdb and the new file is called G:\database.mdbTC
What I want is the file to be called D:\databaseTC.mdb
I think it needs to count from the end backwards and then insert the 'TC' just before the 'dot'. (.mdb). This is because there will be different length filenames but they will always end in .mdb.
Any help would be great.