473,386 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

search/replace

alright, i have an interesting question. I am attempting to make a
music database that will automatically format all of my songs for me so
i don't have to perform the tedious task of doing it myself. What i am
stuck on now is if i have a filename for example "01 Little Wing.mp3" I
want access to remove the "01 " part of the filename. Is this
possible? Any help would be greatly appreciated.

Aug 9 '06 #1
4 1233

gibsonsg...@gmail.com wrote:
alright, i have an interesting question. I am attempting to make a
music database that will automatically format all of my songs for me so
i don't have to perform the tedious task of doing it myself. What i am
stuck on now is if i have a filename for example "01 Little Wing.mp3" I
want access to remove the "01 " part of the filename. Is this
possible? Any help would be greatly appreciated.
Assuming "01 Little Wing.mp3" is in the Current Directory
you could excute this code:

Name "01 Little Wing.mp3" As "Little Wing.mp3"

or, if not in current directory

Name "C:\Documents and Settings\NauseousMusic\01 Little Wing.mp3" As
"C:\Documents and Settings\NauseousMusic\Little Wing.mp3"

Now is that what you want to do?
Who knows?

Maybe you just want code to lop off the first three characters of a
string?
Mid$("01 Little Wing.mp3", 4)

Maybe you want to remove the first "word"?
Mid$("01 Little Wing.mp3", InStr("01 Little Wing.mp3", " ") + 1)

Maybe it's beginning numerals?
Dim s As String
s = "01 Little Wing.mp3"
While IsNumeric(Mid$(s, 1, 1))
s = Mid$(s, 2)
Wend
s = Trim(s)

Maybe it's a combination.

Most likely, it's something else entirely as I am not a good guesser.

Aug 9 '06 #2
sorry if i wasn't clear on what i was trying to do. I want to run
through an entire list in a table and remove the track number. Not all
of them have track numbers so i also want to test to see if the track
number is there. THe track number will always consist of two digits
followed by a space. This is the section of text i want to remove.

Aug 9 '06 #3
gi*********@gmail.com wrote in news:1155124668.427182.113590
@m79g2000cwm.googlegroups.com:
sorry if i wasn't clear on what i was trying to do. I want to run
through an entire list in a table and remove the track number. Not all
of them have track numbers so i also want to test to see if the track
number is there. THe track number will always consist of two digits
followed by a space. This is the section of text i want to remove.
I tried to post an answer in Google Grooups a few minutes ago but it
seems to be caught in an infinite loop somewhere in the ether.

So I'll try again.

Before you try anything, please, make a safety copy of your table/data.

1. Cut and paste these two proceudres into a Standard Module:

Public Function WithoutTrackNumber( _
ByVal SongTitle) As String
WithoutTrackNumber = Nz(SongTitle, "")
While IsNumeric(Mid$(WithoutTrackNumber, 1, 1))
WithoutTrackNumber = Mid$(WithoutTrackNumber, 2)
Wend
WithoutTrackNumber = Trim(WithoutTrackNumber)
End Function

Private Sub ScratchtheTrackNumbers()
CurrentDb().Execute _
"UPDATE TableSongTitles " _
& "SET SongTitle = " _
& "WithoutTrackNumber([SongTitle])"
End Sub

Change the table and field names in the second procedure to match your
table and field names. Don't change anything in the fist procedure.

Save the module.

Run the second procedure. Just in case you don't know how to do this,
here is what works for me.
I make sure the cursor is in the procedure I want to run, in this case
the Private Sub. Then I click on the Green Arrow in theStandard Toolbar
at the top. Provided the Procedure has no required parameters it should
run.

*******
Don't forget:
Before you try anything, please, make a safety copy of your table/data.
*******

But if you are doing this every day for a year you may wish to discard
the Private sub, cut and paste the first procedure (the Public Function)
into as Standard Module and save the module, and paste this SQL string
into a query in SQL view in the Query Builder (and save it) so that you
can just run it. Of course, as before you would have to change the table
and file names to match yours.

UPDATE TableSongTitles SET SongTitle = WithoutTrackNumber([SongTitle])

*******

Did I mention?
Before you try anything, please, make a safety copy of your table/data.

--
Lyle Fairfield
Aug 9 '06 #4
Thanks, i have not tried it out yet, but reading through the code it
all seems to make sense. It seems like it should work, and that was
what I needed.

Aug 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
10
by: pembed2003 | last post by:
Hi all, I asked this question in the C group but no one seems to be interested in answering it. :-( Basically, I wrote a search and replace function so I can do: char source = "abcd?1234?x";...
22
by: Phlip | last post by:
C++ers: Here's an open ended STL question. What's the smarmiest most templated way to use <string>, <algorithms> etc. to turn this: " able search baker search charlie " into this: " able...
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
2
by: Dennis | last post by:
I am trying to implement a "Find and Replace" dialog that allows using wildcards in the find string, much like the Find and Replace Dialogs in Ms Word, etc. Are there any references or examples on...
2
by: Ola K | last post by:
Hi guys, I wrote a script that works *almost* perfectly, and this lack of perfection simply puzzles me. I simply cannot point the whys, so any help on it will be appreciated. I paste it all here,...
9
by: tomjones75 | last post by:
dear community, i want to search the content of all fields in one table in a access database. it already works for the content of one field in the table. please take a look at the code in...
14
by: Simon Gare | last post by:
Hi, have a search.asp page with results.asp page drawing data from an SQL db, problem is the user has to type the whole field value into the search box to retrieve the value on results.asp, what...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.