Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > Horse Race Betting Systems
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 24th May 2006, 09:51 AM
Chinbok Chinbok is offline
Member
 
Join Date: Nov 2005
Posts: 50
Default MS Access Help

I want to convert my racing spreadsheets into an Access database and am trying to teach myself Access using the help files.

One thing I will need to do is rank each horse's rating within a race. The table will consist of multiple races and there is a record for each horse - one of the records is a rating. Using a query, how do I add a field with the ranking?

The table has a field called RaceID which identifies one race from another in the table. Of course, the number of horses in each race can vary.

Any help would be much appreciated.
Reply With Quote
  #2  
Old 24th May 2006, 10:20 AM
Chrome Prince Chrome Prince is offline
Member
 
Join Date: Jan 1970
Posts: 4,429
Default

Oh Chinbok,

I bet you found nothing on the net that even comes close to what you require.

I admire you converting to MSACCESS, but ranking and allowing for date track and race is not easy.
Even the Access "Gurus" were unable to help without dribbling on about VBA and still couldn't get it right after a page and a half of code!

I have since played around with examples and think I'm close to solving it, but it takes a while to get it right.

There are two options:

Option A (easy but time consuming)

Do your rankings in Excel prior to importing.

Sort by whatever it is you are trying to rank, then sort by date,track and race.

Then use this code (assuming date=columnA track=columnB race=column C)

=IF(A1&B1&C1<>A2&B2&C2,1,F1+1)

Assumes column F is the rank field and that row 1 has your column names.

Option B (very hard to explain, but if you get it right, you'll save time in the longrun)

Here's the very best page I found in 3 years on ranking:

http://www.databasejournal.com/feat...10895_3112091_6

It uses the Northwind sample database, but is a hell of a lot better than the Microsoft example.

What you need to do is allow for the other three rank by fields in the code.

Create a query within a query and make the second Query an alias.

For no values or 0 values, you'll have to do an update query.

CAUTION- do NOT use an update query straight away to do your rankings as "orphaned" entries will still get a ranking, you need the records found from relationships to only get a ranking.

Instead do a make table query and then update that table, so you have a new table based on the relationships and can run the update on that.

I need a good lie down now

Best of luck - told you it's hard.
__________________
RaceCensus - powerful system testing software.
Now with over 419,000 Metropolitan, Provincial and Country races!
http://www.propun.com.au/horse_raci...ng_systems.html
*RaceCensus now updated to 31/05/2025
Video overview of RaceCensus here:
http://www.youtube.com/watch?v=W821YP_b0Pg

Last edited by Chrome Prince : 24th May 2006 at 10:22 AM.
Reply With Quote
  #3  
Old 24th May 2006, 10:26 AM
KennyVictor KennyVictor is offline
Member
 
Join Date: Jan 1970
Location: Mt Tamborine
Posts: 574
Default

I don't use access or excel but do use a database. I would have thought that the easiest path would be to export the access data out to a csv file and read that in to the database. Then do what databases are good at (although I have heard less than complimentary things second hand about access compared to "real" databases) and create your rankings within the database.
KV
Reply With Quote
  #4  
Old 24th May 2006, 10:28 AM
Chrome Prince Chrome Prince is offline
Member
 
Join Date: Jan 1970
Posts: 4,429
Default

Yes, that is close to option A and the easiest if you're not prepared to devote a LOT of time to getting it right.
What do you use Kenny, I use Excel Access and finally Filemaker to achieve the end result.
__________________
RaceCensus - powerful system testing software.
Now with over 419,000 Metropolitan, Provincial and Country races!
http://www.propun.com.au/horse_raci...ng_systems.html
*RaceCensus now updated to 31/05/2025
Video overview of RaceCensus here:
http://www.youtube.com/watch?v=W821YP_b0Pg
Reply With Quote
  #5  
Old 24th May 2006, 10:35 AM
KennyVictor KennyVictor is offline
Member
 
Join Date: Jan 1970
Location: Mt Tamborine
Posts: 574
Default

I use a thing called Powerflex - it's a derivative (and a much improved one at that) of Dataflex (which is probably another one you haven't heard of). Dataflex was sort of like DBase IV.
Powerflex is good in that it also has commands for accessing the net and what have you so I can do everything I need within one program.
Reply With Quote
  #6  
Old 24th May 2006, 11:06 AM
Chinbok Chinbok is offline
Member
 
Join Date: Nov 2005
Posts: 50
Default

Thanks for the reply CP. I want to avoid switching to and from excel/access because I want to run >100,00 queries where a rating is calculated and profit/loss stats are calculated looking at the highest rater. Would probably take too long if I had to use both programs.

I could do it now in excel but it would also a long time because my files are so large. I have 6 files about 25Mb each.

A couple of other problems;

I run a query which produces a list of selections with win dividends. I can then run another query on this table to give me:
- no. of selections
- no. of winners
- total of win dividends, etc.
Can I use this query to also calculate the WIN SR and POT? I've worked out how to do it by running another query on the first one but was wondering if it could be done as one.

and

In VBA/excel, I can write code with nested for..next loops to run multiple calculations over and over. Can this be done in Access with a Macro or would I need to use code?

Cheers
Reply With Quote
  #7  
Old 24th May 2006, 11:23 AM
Chrome Prince Chrome Prince is offline
Member
 
Join Date: Jan 1970
Posts: 4,429
Default

Chinbok,

Well with that many records you really have to use Access.
My Excel suggestion was to import rankings into Access as you build up the database, but what you want is rankings based on queries?

If your Excel files are that large, you risk data corruption as well - I lost a whole Excel master list 6 years ago which had months of figures in it

Yes, you can include the other calculations, just create a new calculation field in the query based on the Win dividends.

Example POT:Profit/Number of Bets as a calculation.

Yes you can use a macro, just create a recorded macro and modify it later to suit your needs, then run it as a loop.

You can do just about anything in Access you can think of, BUT some things require a lot of trial and error, such as the dreaded ranking issue.

All over the place you find examples of ranking a set of records in a query - just about nowhere can you find rankings by date,track race.

Have a look at that link I posted, if you can follow the tutorial, you'll catch on quickly how to modify it to include the various categories as well.

If anyone else has a better reference or idea for rankings, I'd sure welcome it.
__________________
RaceCensus - powerful system testing software.
Now with over 419,000 Metropolitan, Provincial and Country races!
http://www.propun.com.au/horse_raci...ng_systems.html
*RaceCensus now updated to 31/05/2025
Video overview of RaceCensus here:
http://www.youtube.com/watch?v=W821YP_b0Pg

Last edited by Chrome Prince : 24th May 2006 at 11:28 AM.
Reply With Quote
  #8  
Old 24th May 2006, 11:19 PM
shoto shoto is offline
Member
 
Join Date: Jan 1970
Location: Brisbane
Posts: 126
Default

CP,
Don't know if this will be helpful or if you're way ahead of this, but ...

In Filemaker data is easily ranked by creating a related file and displaying the required data in a portal, with the data sorted by a field that can be easily changed dynamically using a script. With the data sorted in the desired order, a script inserts the portal row number into the ranking field, and looped to run through a group of records. Exclusions can be easily accomodated with 'if' or 'case' statements.

The shortcoming of this is that it will give each line a ranking, even if the data is equal, but for me that is a small price for such ranking ease.
Reply With Quote
  #9  
Old 25th May 2006, 09:46 AM
Chinbok Chinbok is offline
Member
 
Join Date: Nov 2005
Posts: 50
Default

CP,

Read the article last night which has helped a little. I can now rank all horses in the table. Still not sure how to make it differentiate between races in the table. Is there a mrexcel.com equivalent for Access or SQL?

Cheers
Reply With Quote
  #10  
Old 25th May 2006, 12:28 PM
Chrome Prince Chrome Prince is offline
Member
 
Join Date: Jan 1970
Posts: 4,429
Default

Thanks Shoto,

Yes, I'm aware of that method, but it is very very slow and cumbersome when dealing with 2gb of data. I also try to keep the speed of Filemaker as fast as possible by having all calculations done in Access prior to import.

Thanks for the suggestion though.


Quote:
Originally Posted by Chinbok
CP,

Read the article last night which has helped a little. I can now rank all horses in the table. Still not sure how to make it differentiate between races in the table. Is there a mrexcel.com equivalent for Access or SQL?

Cheers


Chinbok,

That is the trick, the differentiation between races.

Here is some help:

Rank: (SELECT COUNT (*) FROM QrySTAKES WHERE QrySTAKES.STAKES > QrySTAKES1.STAKES And DATE=QrySTAKES1.DATE And TRACK=QrySTAKES1.TRACK And RNO=QrySTAKES1.RNO)

This is the calculation I use for ranking horse prizemoney.
QrySTAKES is a query based on date track race horse prizemoney.
QrySTAKES1 is the alias of QryStakes.

QrySTAKES MUST be sorted date ascending, track ascending, race ascending,prizemoney descending.

You won't find much help out there on doing this, as nobody knows or could be bothered finding the answer,believe me I've posted on every Access forum there is internationally, all they do is tell you how to rank a set of records, not within the set like we need.

So I came up with my own derivation by trial and error.
__________________
RaceCensus - powerful system testing software.
Now with over 419,000 Metropolitan, Provincial and Country races!
http://www.propun.com.au/horse_raci...ng_systems.html
*RaceCensus now updated to 31/05/2025
Video overview of RaceCensus here:
http://www.youtube.com/watch?v=W821YP_b0Pg
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 03:21 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
©2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655