Hello all. I've recently been relearning Access in the last few days and have found this site and other resources very helpful. At the moment, I have two issues related to table properties which should be easy but I'm having trouble figuring them out. I will try to give as much detail about what I'm attempting to do.
For my data, let's say I have something like this with three fields for a motorsports race(I simplified it)
Name Start Finish
John 4 5
Bob 1 3
Tom 2 6
Sarah 6 4
Alice 3 1
Chris 5 2
The name is the name of the driver. Start is their starting position on the grid. Finish is their finishing position in the race.
Now I created a new numeric field, called Top 3.
Top 3: This will be a 1 value for the drivers who finished in the top 3 and a 0 value for the drivers who finished outside the top 3 (ie. 4th, 5th and 6th).
I could just make the default value 0 for this field and then enter a 1 for the drivers who finished in the Top 3 manually in Datasheet View but I want this to be automatic, so that when I enter a Finish position of 1, 2 or 3 for a driver in a race, a 1 will appear on the Top 3 field automatically for those three drivers.
I'm not sure how to set the criteria so this would work.
I tried to make an iif statement in the Validation Rule field but it didn't work.
=IIf([Finish] < 4,1,0).
It returns with an invalid syntax error. Do you have any suggestions on what I need to do? I feel like I'm missing something obvious, can you even do an if then statement in table properties?
--------------
second question:
In this racing season, I have a total of 20 races with the same 6 drivers. I will have a separate table for each race, so there will be a total of 20 tables. After all of this is entered, I decide to make a query in which I create an expression that sums the finishing position of all drivers and then divides it by 20. This could be called the Average Finish.
So each driver will end up with a value, such as Chris might have an average finish of 5.5.
Anyway my issue is, is that the expression would be really long because I am going through each race and summing the Finish position for a total of 20 times before dividing it by 20.
Would there be an easier way to create this expression? Something that would tell Access to simply add the Finish field in all 20 races and divide by 20 at once? (Does this make sense?)
Thanks for any suggestions and let me know if you need additional info.
For my data, let's say I have something like this with three fields for a motorsports race(I simplified it)
Name Start Finish
John 4 5
Bob 1 3
Tom 2 6
Sarah 6 4
Alice 3 1
Chris 5 2
The name is the name of the driver. Start is their starting position on the grid. Finish is their finishing position in the race.
Now I created a new numeric field, called Top 3.
Top 3: This will be a 1 value for the drivers who finished in the top 3 and a 0 value for the drivers who finished outside the top 3 (ie. 4th, 5th and 6th).
I could just make the default value 0 for this field and then enter a 1 for the drivers who finished in the Top 3 manually in Datasheet View but I want this to be automatic, so that when I enter a Finish position of 1, 2 or 3 for a driver in a race, a 1 will appear on the Top 3 field automatically for those three drivers.
I'm not sure how to set the criteria so this would work.
I tried to make an iif statement in the Validation Rule field but it didn't work.
=IIf([Finish] < 4,1,0).
It returns with an invalid syntax error. Do you have any suggestions on what I need to do? I feel like I'm missing something obvious, can you even do an if then statement in table properties?
--------------
second question:
In this racing season, I have a total of 20 races with the same 6 drivers. I will have a separate table for each race, so there will be a total of 20 tables. After all of this is entered, I decide to make a query in which I create an expression that sums the finishing position of all drivers and then divides it by 20. This could be called the Average Finish.
So each driver will end up with a value, such as Chris might have an average finish of 5.5.
Anyway my issue is, is that the expression would be really long because I am going through each race and summing the Finish position for a total of 20 times before dividing it by 20.
Would there be an easier way to create this expression? Something that would tell Access to simply add the Finish field in all 20 races and divide by 20 at once? (Does this make sense?)
Thanks for any suggestions and let me know if you need additional info.