sumuwin
-
Posts
49 -
Joined
-
Last visited
Posts posted by sumuwin
-
-
Re: Archive Racecards Hi I might be able to help you here PM me your email address. atb sumuwin
-
Re: Anyone want a horse racing database ? Hi Tull I don't use PatternForm but a few years ago I wrote some code in Excel (2003) that would open PatternForm in an browser in Excel and with a few clicks, copy the data e.g. Lifetime, Course, Going etc into separate sheets depending on what you selected. If you want to send me a sample of what you do for one race I'll see if I can adapt this to do what you need. (If anyone wants a copy of the spreadsheet just pm me.) atb sumuwin
-
Re: Anyone want a horse racing database ? HI LR I'd like to see your script as well - I may be able to speed it up. It shouldn't take 4hrs to get a month's results. all the best sumuwin
-
Re: Race Results download Hi here are a couple of sources Monthly CSV files are available here http://82.153.163.104/Archive_UKHorseRacing/CSVResults/default.asp or you could download RacingSense from here (over 200mb zipped) http://www.simplesoftware.co.uk/ssr1.htm If you want to grab your own data Sporting Life is probably the easiest - I have some excel vba code that gets the basic info from here if you want it (saves to "normalised" text files as well for database import) There's also some good stuff in this thread if you want to scrape the Racing Post but they tend to change their pages pretty frequently http://www.punterslounge.com/forum/f23/getting-data-rp-online-cards-29624/ all the best sumuwin
-
Re: Anyone want a horse racing database ? With some modification you can use vbscript to create the database and to provide the updates. The update code could be automated from your SQL files but it's probably easier to create csv files for the user to import. Here's some sample code - copy into a text editor (e.g. notepad) and save the file with extension vbs. Double click the file to run.
To create database C:\sumuwin.mdb strFileName = "C:\sumuwin" Set objCatalog = CreateObject("ADOX.Catalog") objCatalog.Create "Provider = Microsoft.Jet.OLEDB.4.0;Data Source =" & strFileName & ".Mdb" & ";" Set objConnection = CreateObject("ADODB.Connection") objConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source =" & strFileName & ".Mdb" & ";" objConnection.Execute "Create Table Horse(" & _ "HorseID long not null," & _ "Name varchar(25) null," & _ "Registration_country varchar(3) null,[DateofBirth] datetime null," & _ "Sex varchar(25) null , Breeding varchar(255) null, Primary Key (HorseID))" objConnection.Execute "Create Table jockey(" & _ "JockeyID counter," & _ "lastName varchar(50) default null," & _ "firstname varchar(50) default null,firstinitial char(5) default null," & _ "Title varchar(15) default null , Gender byte default null)" objConnection.Close Set objCatalog = Nothing Set objConnection = Nothing MsgBox strfilename & " has been created."
To update Horse details strFileName = "C:\sumuwin" Set objConnection = CreateObject("ADODB.Connection") objConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source =" & strFileName & ".Mdb" & ";" mySQL = "delete * from horse where HORSEID IN " _ & "(89083,89244,91618,94637,97245,98569,98580,100039)" objConnection.Execute mySQL REM create a string containing all the horse fields then create array from the string REM loop through the array and insert the values mystr = "" mystr = mystr & "(89083,'Kaiser Willie','IRE');" mystr = mystr & "(89244,'Protiva','GBR');" mystr = mystr & "(91618,'Yellow Printer','GBR');" mystr = mystr & "(94637,'Winrob','GBR');" mystr = mystr & "(96063,'Young Star Gazer','GBR');" mystr = mystr & "(97245,'Niceonefrankie','GBR');" mystr = mystr & "(98569,'Caucus','GBR');" mystr = mystr & "(98580,'Top Spin','IRE');" mystr = mystr & "(100039,'Futurist','GBR')" myarray = Split(mystr, ";") For i = 0 To UBound(myarray) myvalues = myarray(i) mySQL="Insert into horse (HORSEID,name,registration_country) " _ & " values " & myvalues & "" objConnection.Execute mySQL Next objConnection.Close Set objConnection = Nothing MsgBox "Horses Updated."
all the best sumuwin
-
Re: Anyone want a horse racing database ? Hi Datapunter I can take a look at it in Access. I already have several large Access databases and have been intending to migrate to mySQL or SQLServer for a while - just haven't found the time. I may also be able to provide some data that might be of use - pm me if you want to discuss. all the best sumuwin
-
Re: RP Link extractions from Web to EXCEL Excellent spot! I think I'll need to rewrite in MS Access now - should be much quicker. cheers sumuwin
-
Re: RP Link extractions from Web to EXCEL No problem! Will take a look at future cards - I think I can get this from the runners index. Unfortunately I'm not able to get the future results!
-
Re: RP Link extractions from Web to EXCEL This will do what you want. You can do up to 7 days at once. You just need to enter the start and end dates.
I have code that does the rest too (ie. get the results). all the best sumuwinSub RaceDates() Dim startdate, enddate Dim mystart, myend Dim startday, startmonth, startyear Dim endday, endmonth, endyear Dim myURL startdate = InputBox("Enter Start Date as dd/mm/yy") enddate = InputBox("Enter End Date as dd/mm/yy") Application.ScreenUpdating = False Range("A1").Select startday = Format(CInt(Day(startdate)), "00") startmonth = Format(CInt(Month(startdate)), "00") startyear = CInt(Year(startdate)) endday = Format(CInt(Day(enddate)), "00") endmonth = Format(CInt(Month(enddate)), "00") endyear = CInt(Year(enddate)) myURL = "URL;http://www.racingpost.co.uk/horses/result_search.sd?crs=&r_date=&start_search=1&search_title=Title+or+part+of&search_country=GB&search_course=Any" mystart = "&from_day=" & startday & "&from_month=" & startmonth & "&from_year=" & startyear & "" myend = "&until_day=" & endday & "&until_month=" & endmonth & "&until_year=" & endyear With ActiveSheet.QueryTables.Add(Connection:=myURL & mystart & myend, Destination:=ActiveCell) .FieldNames = True .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingAll .WebTables = "8" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = True .WebDisableDateRecognition = True .WebDisableRedirections = True .Refresh BackgroundQuery:=False End With Cells.Select With Selection .VerticalAlignment = xlBottom .WrapText = False .MergeCells = False End With Columns("A:B").Select Selection.Delete Shift:=xlToLeft Columns("B").Select Selection.Delete Shift:=xlToLeft Range("A1").Select myrows = Cells(Rows.Count, 1).End(xlUp).Row For i = 1 To myrows If Cells(i, 1).Hyperlinks.Count > 0 Then Cells(i, 1).Offset(0, 1).Value = Cells(i, 1).Hyperlinks(1).Address End If Next i Columns("B:B").Select Selection.Replace What:="*horses/", replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Application.screenupdating=True End Sub
Anyone want a horse racing database ?
in At The Races - Racing Forum
Posted
Re: Anyone want a horse racing database ? Hi LR If you had a full copy of the code rather than the part you adapted from Evergreen's post it wouldn't have taken 7 days to load 9 months data. If you want the missing code you can have it. sumuwin