Good day,
I hoping someone can help me out, I have some code that enables me to read a fixed width text files data into my database, which works fine, however I also have a text file which is not fixed width or of csv type which I want to read into my database, but I’m stuck on how to amend my code to get what I want and I would appreciate it if someone could find the time to help me with that.
Below is the code that I currently have that reads the fixed width text files.
And the sample data below is the data in a text file that I want to read into my database.
<Song FilePath="C:\Users\John Lee\Music\00's\All Saints\On & On.wma" FileSize="5773158">
<Display Author="All Saints" Title="On & On" Genre="Pop" Color="7693971" Tag="2" />
<Infos SongLength="10543104" FirstSeen="802110639" />
<BPM Bpm="26199" Phase="21358" BeatPhase="2" />
<FAME IsScanned="1" Volume="8099" />
<Automix MixType="1" CutStart="427520" CutEnd="9505472" FadeStart="428032" FadeEnd="10279424" RealStart="0" RealEnd="10542592" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\70's Rock\America\Ventura Highway.wma" FileSize="3366714">
<Display Author="America" Title="Ventura Highway" Genre="Rock" Year="1972" Color="7863208" Cover="2048" Tag="2" />
<Infos SongLength="9179136" FirstSeen="802110652" />
<BPM Bpm="16174" Phase="11504" />
<FAME IsScanned="1" Volume="6043" />
<Automix FadeStart="671232" FadeEnd="8748032" RealStart="0" RealEnd="9178624" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's\All Saints\Chick Fit.wma" FileSize="5164756">
<Display Author="All Saints" Title="Chick Fit" Genre="Pop" Color="6179899" Tag="2" />
<Infos SongLength="9431040" FirstSeen="802110639" />
<BPM Bpm="26457" Phase="13196" />
<FAME IsScanned="1" Volume="8157" />
<Automix MixType="1" CutStart="13056" CutEnd="9200704" FadeStart="26112" FadeEnd="9271808" RealStart="0" RealEnd="9430528" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's\Amillionsons\Misty Blue.wma" FileSize="3641588">
<Display Author="Amillionsons" Title="Misty Blue" Genre="Pop" Year="2002" Color="33253" Tag="2" />
<Infos SongLength="9936896" FirstSeen="802110639" />
<BPM Bpm="23077" Phase="9232" />
<FAME IsScanned="1" Volume="7705" />
<Automix MixType="1" CutStart="1194048" CutEnd="8594112" FadeStart="343040" FadeEnd="9329152" RealStart="0" RealEnd="9936384" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\70's\Stylistics\Betcha By Golly, Wow.wma" FileSize="3205292">
<Display Author="Stylistics" Title="Betcha By Golly, Wow" Genre="Pop" Year="1972" Color="14197421" Cover="2048" Tag="2" />
<Infos SongLength="8740864" FirstSeen="802110652" />
<BPM Bpm="16608" Phase="10592" />
<FAME IsScanned="1" Volume="6032" />
<Automix FadeStart="17408" FadeEnd="8230912" RealStart="0" RealEnd="8740352" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's House\Tears For Fears\The closest thing to heaven (BIR MIX).wma" FileSize="7968220">
<Display Author="Tears For Fears" Title="The Closest Thing To Heaven (BIR MIX)" Genre="House" Color="15346150" Tag="2" />
<Infos SongLength="21803008" FirstSeen="802110642" />
<BPM Bpm="20356" Phase="1044" BeatPhase="3" />
<FAME IsScanned="1" Volume="7187" />
<Automix MixType="3" TempoStart="652436" TempoEnd="20845588" CutStart="795264" CutEnd="21618656" FadeStart="16896" FadeEnd="21641216" RealStart="0" RealEnd="21802496" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\Albums\Fleetwood Mac\Watch Out!.wma" FileSize="6170418">
<Display Author="Fleetwood Mac" Title="Watch Out!" Genre="Rock" Color="10388472" Cover="2048" Tag="2" />
<Infos SongLength="11237376" FirstSeen="802110659" />
<BPM Bpm="23456" Phase="6112" />
<FAME IsScanned="1" Volume="3331" />
<Automix CutStart="797120" FadeStart="54784" FadeEnd="11064832" RealStart="0" RealEnd="11236864" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's Indie\Arctic Monkeys\I Bet You Look Good On The Dancefloor.wma" FileSize="4255218">
<Display Author="Arctic Monkeys" Title="I Bet You Look Good On The Dancefloor" Genre="Indie" Color="8368481" Tag="2" />
<Infos SongLength="7757824" FirstSeen="802110642" />
<BPM Bpm="25544" Phase="18848" BeatPhase="1" />
<FAME IsScanned="1" Volume="8590" />
<Automix MixType="3" TempoStart="759624" TempoEnd="6481480" CutStart="51392" CutEnd="7198112" FadeStart="22528" FadeEnd="7469056" RealStart="0" RealEnd="7757312" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\80's\Lotus Eaters\First Picture Of You.wma" FileSize="5344768">
<Display Author="Lotus Eaters" Title="First Picture Of You" Genre="Pop" Year="1983" Color="733642" Cover="2048" Tag="2" />
<Infos SongLength="14604288" FirstSeen="802110654" />
<BPM Bpm="16070" Phase="9160" BeatPhase="3" />
<FAME IsScanned="1" Volume="5794" />
<Automix FadeStart="1831424" FadeEnd="14229504" RealStart="0" RealEnd="14603776" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\50's\Jive Aces\Sweet Gerogia Brown.wma" FileSize="3139052">
<Display Author="Jive Aces" Title="Sweet Gerogia Brown" Genre="Swing" Color="3855444" Tag="2" />
<Infos SongLength="8560640" FirstSeen="803161041" />
<BPM Bpm="19320" Phase="12736" BeatPhase="1" />
<FAME IsScanned="1" Volume="7751" />
<Automix TempoStart="920776" FadeStart="28160" FadeEnd="8423424" RealStart="0" RealEnd="8560128" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\60's\Susan Maughan\Bobby's Girl.mp3" FileSize="3343612">
<Display Author="Susan Maughan" Title="Bobby's Girl" Genre="Rock 'N' Roll" Year="1962" Color="16286289" Cover="2" Tag="1" />
<Infos SongLength="6879744" FirstSeen="802110650" FirstPlay="806132048" LastPlay="1307022126" PlayCount="4" Bitrate="160" BpmTag="19322" />
<BPM Bpm="18528" Phase="1088" BeatPhase="2" />
<FAME IsScanned="1" Volume="6875" />
<Automix MixType="1" CutStart="38336" CutEnd="6369760" FadeStart="16896" FadeEnd="6707200" RealStart="0" RealEnd="6879232" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\70's Reggae\Judge Dread\The Winkle Man.wma" FileSize="2822926">
<Display Author="Judge Dread" Title="The Winkle Man" Genre="Reggae" Year="1976" Color="1939604" Cover="2048" Tag="2" />
<Infos SongLength="7684096" FirstSeen="802110652" />
<BPM Bpm="32328" Phase="4896" BeatPhase="1" />
<FAME IsScanned="1" Volume="6741" />
<Automix MixType="1" CutStart="19200" CutEnd="6380384" FadeStart="26112" FadeEnd="7428608" RealStart="0" RealEnd="7683584" />
</Song>
The Data in red is the data I want to read into my database and the data in blue is the trigger to identify the data to be read. As you can see from the sample data not all of them have a Year associated with them, so I need to be able to have code that can search for the trigger data and then read in the data to the right of that trigger data, the data to read will always appear between double quotes to the right of the trigger data and after the equals symbol.
So in my database the trigger data is associated with the fields shown below:
Database Text File
Fields Data
strArtist - Display Author
strSongTitle - Title
strGenre - Genre
strYear - Year
Regards
John
I hoping someone can help me out, I have some code that enables me to read a fixed width text files data into my database, which works fine, however I also have a text file which is not fixed width or of csv type which I want to read into my database, but I’m stuck on how to amend my code to get what I want and I would appreciate it if someone could find the time to help me with that.
Below is the code that I currently have that reads the fixed width text files.
Code:
[COLOR=blue][FONT=Times New Roman]Option Compare Database[/FONT][/COLOR]
[FONT=Times New Roman][COLOR=blue]Public[/COLOR] FileName [COLOR=blue]As String[/COLOR][/FONT]
[FONT=Times New Roman][COLOR=blue]Function[/COLOR] eFlowProcess3()[/FONT]
[COLOR=green][FONT=Times New Roman]'=============================================[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'References:[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Visual Basic For Applications[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft Access 9.0 Object Library[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft DAO 3.6 Object Library[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft Excell 11.0 Object Library[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft Outlook 14.0 Object Library[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft Word 14.0 Object Library[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft Scripting Runtime[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'OLE Automation[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft ActiveX Date Objects 2.1 Library[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'Microsoft Outlook View Control[/FONT][/COLOR]
[COLOR=green][FONT=Times New Roman]'=============================================[/FONT][/COLOR]
[FONT=Times New Roman]DoCmd.Echo [COLOR=blue]False[/COLOR], "Running Program - mod_eFlowProcess3" [/FONT]
[FONT=Times New Roman]DoCmd.Hourglass [COLOR=blue]True[/COLOR][/FONT]
[FONT=Times New Roman]DoCmd.SetWarnings [COLOR=blue]False[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] filenum [COLOR=blue]As Integer[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] Count [COLOR=blue]As Long[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] tmp [COLOR=blue]As String[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] rst [COLOR=blue]As[/COLOR] DAO.Recordset [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] DB [COLOR=blue]As[/COLOR] Database [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] FS [COLOR=blue]As[/COLOR] FileSystemObject [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] Folder [COLOR=blue]As[/COLOR] Folder [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] subFolder [COLOR=blue]As[/COLOR] Folder [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] File [COLOR=blue]As[/COLOR] File [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] TextFilePath [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] dtmDate [COLOR=blue]As[/COLOR] [COLOR=blue]Date[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] dtmFileDate [COLOR=blue]As Date[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] TextFileDate [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] NameOfFile [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] FileNameWithExt [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] strTemp [COLOR=blue]As String[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] FileLoc [COLOR=blue]As String[/COLOR] [/FONT]
[FONT=Times New Roman] [COLOR=blue]Const[/COLOR] ForReading = 1 [/FONT]
[FONT=Times New Roman] [COLOR=blue]Set[/COLOR] DB = CurrentDb [/FONT]
[FONT=Times New Roman] [COLOR=blue]Set[/COLOR] FS = CreateObject("Scripting.FileSystemObject") [/FONT]
[FONT=Times New Roman] dtmDate = Date [/FONT]
[FONT=Times New Roman] TextFilePath = "H:\John Lee\Test Folders\" [/FONT]
[FONT=Times New Roman] [COLOR=blue]Set[/COLOR] Folder = FS.GetFolder(TextFilePath) [/FONT]
[FONT=Times New Roman] [COLOR=blue]For Each[/COLOR] subFolder [COLOR=blue]In[/COLOR] Folder.SubFolders [/FONT]
[FONT=Times New Roman] [COLOR=blue]For Each[/COLOR] File [COLOR=blue]In[/COLOR] subFolder.Files[/FONT]
[FONT=Times New Roman] NameOfFile = GetAttr("File.Name") [/FONT]
[FONT=Times New Roman] [COLOR=blue]If[/COLOR] Right(File.Name, 4) = ".txt" [COLOR=blue]Then[/COLOR] [/FONT]
[FONT=Times New Roman] FileNameWithExt = Mid$(File.Name, InStrRev(File.Name, "\") + 1) [/FONT]
[FONT=Times New Roman] strTemp = Mid$(File.Name, InStrRev(File.Name, "\") + 1)[/FONT]
[FONT=Times New Roman] NameOfFile = Left$(strTemp, InStrRev(strTemp, ".") - 1) [/FONT]
[FONT=Times New Roman] subFilePath = Left$(subFolder, InStrRev(subFolder, "\")) [/FONT]
[FONT=Times New Roman] SubFolderName = Mid$(subFolder, InStr(3, subFolder, "\")) [/FONT]
[FONT=Times New Roman] FileLoc = subFolder & "\" & File.Name [/FONT]
[FONT=Times New Roman] [COLOR=blue]If[/COLOR] File.Name <> "rtmail.txt" [COLOR=blue]Then[/COLOR] [/FONT]
[FONT=Times New Roman] FileName = SubFolderName & "\" & File.Name[/FONT]
[FONT=Times New Roman] [COLOR=blue]Call[/COLOR] ReadTextFile[/FONT]
[FONT=Times New Roman] [COLOR=blue]End If[/COLOR][/FONT]
[FONT=Times New Roman] [COLOR=blue]End If[/COLOR][/FONT]
[FONT=Times New Roman] DoEvents[/FONT]
[FONT=Times New Roman] DoCmd.Echo [COLOR=blue]True[/COLOR], "PROCESS 3: Importing Text Files From Live Drive Location: " & NameOfFile & ".txt" [/FONT]
[FONT=Times New Roman] [COLOR=blue]Next[/COLOR][/FONT]
[FONT=Times New Roman] [COLOR=blue]Next[/COLOR][/FONT]
[FONT=Times New Roman] DoCmd.Echo [COLOR=blue]True[/COLOR], "Program End" [/FONT]
[FONT=Times New Roman] DoCmd.Hourglass [COLOR=blue]False[/COLOR] [/FONT]
[FONT=Times New Roman] DoCmd.SetWarnings [COLOR=blue]True[/COLOR] [/FONT]
[COLOR=blue][FONT=Times New Roman]End Function[/FONT][/COLOR]
Code:
[FONT=Times New Roman][COLOR=blue]Function[/COLOR] ReadTextFile()[/FONT]
[COLOR=blue][FONT=Times New Roman]On Error Resume Next[/FONT][/COLOR]
[FONT=Times New Roman][COLOR=blue]Dim[/COLOR] DB [COLOR=blue]As[/COLOR] Database[/FONT]
[FONT=Times New Roman][COLOR=blue]Dim[/COLOR] rst [COLOR=blue]As[/COLOR] DAO.Recordset[/FONT]
[FONT=Times New Roman][COLOR=blue]Dim[/COLOR] FileToProcess [COLOR=blue]As String[/COLOR][/FONT]
[FONT=Times New Roman]FileToProcess = FileName[/FONT]
[FONT=Times New Roman][COLOR=blue]Set[/COLOR] ObjFSO = CreateObject("Scripting.FileSystemObject") [/FONT]
[FONT=Times New Roman][COLOR=blue]Set[/COLOR] ObjFile = ObjFSO.OpenTextFile(FileToProcess, 1) [/FONT]
[FONT=Times New Roman][COLOR=blue]Set[/COLOR] DB = CurrentDb[/FONT]
[FONT=Times New Roman][COLOR=blue]Do Until[/COLOR] ObjFile.AtEndOfStream [/FONT]
[FONT=Times New Roman] ObjFile.Skip (1)[/FONT]
[FONT=Times New Roman] strBranchNoTextFile = ObjFile.Read(2)[/FONT]
[FONT=Times New Roman] ObjFile.Skip (12)[/FONT]
[FONT=Times New Roman] strTitleTextFile = ObjFile.Read(10)[/FONT]
[FONT=Times New Roman] strInitialsTextFile = ObjFile.Read(15)[/FONT]
[FONT=Times New Roman] strSurnameTextFile = ObjFile.Read(25)[/FONT]
[FONT=Times New Roman] strFirstLineAddTextFile = ObjFile.Read(30)[/FONT]
[FONT=Times New Roman] strSecondLineAddTextFile = ObjFile.Read(30)[/FONT]
[FONT=Times New Roman] strThirdLineAddTextFile = ObjFile.Read(30)[/FONT]
[FONT=Times New Roman] strForthLineAddTextFile = ObjFile.Read(30)[/FONT]
[FONT=Times New Roman] strPostCodeTextFile = ObjFile.Read(8)[/FONT]
[FONT=Times New Roman] strTelNoTextFile = ObjFile.Read(15)[/FONT]
[FONT=Times New Roman] strDoBTextFile = ObjFile.Read(7)[/FONT]
[FONT=Times New Roman] strstrManufacturerTextFile = ObjFile.Read(10)[/FONT]
[FONT=Times New Roman] strstrModelNoTextFile = ObjFile.Read(15)[/FONT]
[FONT=Times New Roman] strApplianceDescriptionTextFile = ObjFile.Read(30)[/FONT]
[FONT=Times New Roman] strProductCodeTextFile = ObjFile.Read(6)[/FONT]
[FONT=Times New Roman] strCoverPeriodTextFile = ObjFile.Read(1)[/FONT]
[FONT=Times New Roman] strSerialNoTextFile = ObjFile.Read(20)[/FONT]
[FONT=Times New Roman] strPurchaseDateTextFile = ObjFile.Read(6)[/FONT]
[FONT=Times New Roman] strPurchasePriceTextFile = ObjFile.Read(7)[/FONT]
[FONT=Times New Roman] ObjFile.Skip (37)[/FONT]
[FONT=Times New Roman] strDPATextFile = ObjFile.Read(1)[/FONT]
[FONT=Times New Roman] strExtendedPeriodText = ObjFile.Read(1)[/FONT]
[FONT=Times New Roman] strAgentNoTextFile = ObjFile.Read(5)[/FONT]
[FONT=Times New Roman] strEmailAddTextFile = ObjFile.Read(50)[/FONT]
[FONT=Times New Roman] ObjFile.Skip (20)[/FONT]
[FONT=Times New Roman] strScannedBatchNoTextFile = ObjFile.Read(8)[/FONT]
[FONT=Times New Roman] strScannedBatchDateTextFile = ObjFile.Read(8)[/FONT]
[FONT=Times New Roman] strUserIDTextFile = ObjFile.Read(10)[/FONT]
[FONT=Times New Roman] strImagePathTextFile = ObjFile.Read(250)[/FONT]
[FONT=Times New Roman] [COLOR=blue]Set[/COLOR] rst = DB.OpenRecordset("tblTextFile") [/FONT]
[FONT=Times New Roman] rst.AddNew [/FONT]
[FONT=Times New Roman] rst!strBranchNo = strBranchNoTextFile[/FONT]
[FONT=Times New Roman] rst!strTitle = strTitleTextFile[/FONT]
[FONT=Times New Roman] rst!strInitials = strInitialsTextFile[/FONT]
[FONT=Times New Roman] rst!strSurname = strSurnameTextFile[/FONT]
[FONT=Times New Roman] rst!strFirstLineAdd = strFirstLineAddTextFile[/FONT]
[FONT=Times New Roman] rst!strSecondLineAdd = strSecondLineAddTextFile[/FONT]
[FONT=Times New Roman] rst!strThirdLineAdd = strThirdLineAddTextFile[/FONT]
[FONT=Times New Roman] rst!strForthLineAdd = strForthLineAddTextFile[/FONT]
[FONT=Times New Roman] rst!strPostCode = strPostCodeTextFile[/FONT]
[FONT=Times New Roman] rst!strTelephoneNo = strTelNoTextFile[/FONT]
[FONT=Times New Roman] rst!strDoB = strDoBTextFile[/FONT]
[FONT=Times New Roman] rst!strManufacturer = strstrManufacturerTextFile[/FONT]
[FONT=Times New Roman] rst!strModelNo = strstrModelNoTextFile[/FONT]
[FONT=Times New Roman] rst!strApplianceDescription = strApplianceDescriptionTextFile[/FONT]
[FONT=Times New Roman] rst!strProductCode = strProductCodeTextFile[/FONT]
[FONT=Times New Roman] rst!strCoverPeriod = strCoverPeriodTextFile[/FONT]
[FONT=Times New Roman] rst!strSerialNo = strSerialNoTextFile[/FONT]
[FONT=Times New Roman] rst!strPurchaseDate = strPurchaseDateTextFile[/FONT]
[FONT=Times New Roman] rst!strPurchasePrice = strPurchasePriceTextFile[/FONT]
[FONT=Times New Roman] rst!StrDPA = strDPATextFile[/FONT]
[FONT=Times New Roman] rst!strExtendedPeriod = strExtendedPeriodTextFile[/FONT]
[FONT=Times New Roman] rst!strAgentNo = strAgentNoTextFile[/FONT]
[FONT=Times New Roman] rst!strEmailAdd = strEmailAddTextFile[/FONT]
[FONT=Times New Roman] rst!strScannedBatchNo = strScannedBatchNoTextFile[/FONT]
[FONT=Times New Roman] rst!strScannedBatchDate = strScannedBatchDateTextFile[/FONT]
[FONT=Times New Roman] rst!strUserID = strUserIDTextFile[/FONT]
[FONT=Times New Roman] rst!strImagePath = strImagePathTextFile[/FONT]
[FONT=Times New Roman] rst.Update[/FONT]
[FONT=Times New Roman] rst.Close[/FONT]
[FONT=Times New Roman] [COLOR=blue]Set[/COLOR] rst = [COLOR=blue]Nothing[/COLOR][/FONT]
[FONT=Times New Roman] ObjFile.SkipLine[/FONT]
[FONT=Times New Roman][COLOR=blue]Loop[/COLOR][/FONT]
[FONT=Times New Roman]ObjFile.Close [/FONT]
[COLOR=blue][FONT=Times New Roman]End Function[/FONT][/COLOR]
And the sample data below is the data in a text file that I want to read into my database.
<Song FilePath="C:\Users\John Lee\Music\00's\All Saints\On & On.wma" FileSize="5773158">
<Display Author="All Saints" Title="On & On" Genre="Pop" Color="7693971" Tag="2" />
<Infos SongLength="10543104" FirstSeen="802110639" />
<BPM Bpm="26199" Phase="21358" BeatPhase="2" />
<FAME IsScanned="1" Volume="8099" />
<Automix MixType="1" CutStart="427520" CutEnd="9505472" FadeStart="428032" FadeEnd="10279424" RealStart="0" RealEnd="10542592" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\70's Rock\America\Ventura Highway.wma" FileSize="3366714">
<Display Author="America" Title="Ventura Highway" Genre="Rock" Year="1972" Color="7863208" Cover="2048" Tag="2" />
<Infos SongLength="9179136" FirstSeen="802110652" />
<BPM Bpm="16174" Phase="11504" />
<FAME IsScanned="1" Volume="6043" />
<Automix FadeStart="671232" FadeEnd="8748032" RealStart="0" RealEnd="9178624" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's\All Saints\Chick Fit.wma" FileSize="5164756">
<Display Author="All Saints" Title="Chick Fit" Genre="Pop" Color="6179899" Tag="2" />
<Infos SongLength="9431040" FirstSeen="802110639" />
<BPM Bpm="26457" Phase="13196" />
<FAME IsScanned="1" Volume="8157" />
<Automix MixType="1" CutStart="13056" CutEnd="9200704" FadeStart="26112" FadeEnd="9271808" RealStart="0" RealEnd="9430528" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's\Amillionsons\Misty Blue.wma" FileSize="3641588">
<Display Author="Amillionsons" Title="Misty Blue" Genre="Pop" Year="2002" Color="33253" Tag="2" />
<Infos SongLength="9936896" FirstSeen="802110639" />
<BPM Bpm="23077" Phase="9232" />
<FAME IsScanned="1" Volume="7705" />
<Automix MixType="1" CutStart="1194048" CutEnd="8594112" FadeStart="343040" FadeEnd="9329152" RealStart="0" RealEnd="9936384" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\70's\Stylistics\Betcha By Golly, Wow.wma" FileSize="3205292">
<Display Author="Stylistics" Title="Betcha By Golly, Wow" Genre="Pop" Year="1972" Color="14197421" Cover="2048" Tag="2" />
<Infos SongLength="8740864" FirstSeen="802110652" />
<BPM Bpm="16608" Phase="10592" />
<FAME IsScanned="1" Volume="6032" />
<Automix FadeStart="17408" FadeEnd="8230912" RealStart="0" RealEnd="8740352" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's House\Tears For Fears\The closest thing to heaven (BIR MIX).wma" FileSize="7968220">
<Display Author="Tears For Fears" Title="The Closest Thing To Heaven (BIR MIX)" Genre="House" Color="15346150" Tag="2" />
<Infos SongLength="21803008" FirstSeen="802110642" />
<BPM Bpm="20356" Phase="1044" BeatPhase="3" />
<FAME IsScanned="1" Volume="7187" />
<Automix MixType="3" TempoStart="652436" TempoEnd="20845588" CutStart="795264" CutEnd="21618656" FadeStart="16896" FadeEnd="21641216" RealStart="0" RealEnd="21802496" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\Albums\Fleetwood Mac\Watch Out!.wma" FileSize="6170418">
<Display Author="Fleetwood Mac" Title="Watch Out!" Genre="Rock" Color="10388472" Cover="2048" Tag="2" />
<Infos SongLength="11237376" FirstSeen="802110659" />
<BPM Bpm="23456" Phase="6112" />
<FAME IsScanned="1" Volume="3331" />
<Automix CutStart="797120" FadeStart="54784" FadeEnd="11064832" RealStart="0" RealEnd="11236864" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\00's Indie\Arctic Monkeys\I Bet You Look Good On The Dancefloor.wma" FileSize="4255218">
<Display Author="Arctic Monkeys" Title="I Bet You Look Good On The Dancefloor" Genre="Indie" Color="8368481" Tag="2" />
<Infos SongLength="7757824" FirstSeen="802110642" />
<BPM Bpm="25544" Phase="18848" BeatPhase="1" />
<FAME IsScanned="1" Volume="8590" />
<Automix MixType="3" TempoStart="759624" TempoEnd="6481480" CutStart="51392" CutEnd="7198112" FadeStart="22528" FadeEnd="7469056" RealStart="0" RealEnd="7757312" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\80's\Lotus Eaters\First Picture Of You.wma" FileSize="5344768">
<Display Author="Lotus Eaters" Title="First Picture Of You" Genre="Pop" Year="1983" Color="733642" Cover="2048" Tag="2" />
<Infos SongLength="14604288" FirstSeen="802110654" />
<BPM Bpm="16070" Phase="9160" BeatPhase="3" />
<FAME IsScanned="1" Volume="5794" />
<Automix FadeStart="1831424" FadeEnd="14229504" RealStart="0" RealEnd="14603776" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\50's\Jive Aces\Sweet Gerogia Brown.wma" FileSize="3139052">
<Display Author="Jive Aces" Title="Sweet Gerogia Brown" Genre="Swing" Color="3855444" Tag="2" />
<Infos SongLength="8560640" FirstSeen="803161041" />
<BPM Bpm="19320" Phase="12736" BeatPhase="1" />
<FAME IsScanned="1" Volume="7751" />
<Automix TempoStart="920776" FadeStart="28160" FadeEnd="8423424" RealStart="0" RealEnd="8560128" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\60's\Susan Maughan\Bobby's Girl.mp3" FileSize="3343612">
<Display Author="Susan Maughan" Title="Bobby's Girl" Genre="Rock 'N' Roll" Year="1962" Color="16286289" Cover="2" Tag="1" />
<Infos SongLength="6879744" FirstSeen="802110650" FirstPlay="806132048" LastPlay="1307022126" PlayCount="4" Bitrate="160" BpmTag="19322" />
<BPM Bpm="18528" Phase="1088" BeatPhase="2" />
<FAME IsScanned="1" Volume="6875" />
<Automix MixType="1" CutStart="38336" CutEnd="6369760" FadeStart="16896" FadeEnd="6707200" RealStart="0" RealEnd="6879232" />
</Song>
<Song FilePath="C:\Users\John Lee\Music\70's Reggae\Judge Dread\The Winkle Man.wma" FileSize="2822926">
<Display Author="Judge Dread" Title="The Winkle Man" Genre="Reggae" Year="1976" Color="1939604" Cover="2048" Tag="2" />
<Infos SongLength="7684096" FirstSeen="802110652" />
<BPM Bpm="32328" Phase="4896" BeatPhase="1" />
<FAME IsScanned="1" Volume="6741" />
<Automix MixType="1" CutStart="19200" CutEnd="6380384" FadeStart="26112" FadeEnd="7428608" RealStart="0" RealEnd="7683584" />
</Song>
The Data in red is the data I want to read into my database and the data in blue is the trigger to identify the data to be read. As you can see from the sample data not all of them have a Year associated with them, so I need to be able to have code that can search for the trigger data and then read in the data to the right of that trigger data, the data to read will always appear between double quotes to the right of the trigger data and after the equals symbol.
So in my database the trigger data is associated with the fields shown below:
Database Text File
Fields Data
strArtist - Display Author
strSongTitle - Title
strGenre - Genre
strYear - Year
Regards
John