Golf Scorecard Issue? (1 Viewer)

S

SiRJones

Guest
Hi,

I am semi new to Access and VB language so please bare with me. I am creating a small "golf score card" database for myself. My problem is I can not figure out how to add up my "birdies, Pars, Bogeys" etc. in a field ie. Out of 18 holes I got 4 birdies. I want my "birdies" field to display 4. and the same for my "par" field and "bogeys". I have it so if my score for that hole is < the par for the hole the backcolor turns a certain color...bla bla...but I also want it to add a 1 to my "birdie" field. If I make a mistake and change it from a birdie to a par...I want that "1" in the "birdie" field to erase. Please someone help.

Thanks
SiR Jones
 

jjturner

Registered User.
Local time
Today, 09:15
Joined
Sep 1, 2002
Messages
386
Sir Jones,

Off the bat, several potential solutions come to mind (because alot depends on your table design / form design):

1) You could create a Totals query whose calculated fields would represent your Score Type fields (i.e. # Birdies, # Pars, etc.) using the conditional IIf function to evaluate each hole's score to determine Score Type, then add it to your Birdie total, for instance

2) You could create a custom subroutine in your form's class module that gets called on the AfterUpdate event of each hole's Score textbox, and this would then re-calculate/re-populate the # Birdies box, and/or # Pars box, etc.

3) You could create an 18-field expression as the ControlSource for each of your Score Type fields (i.e. # Birdies, # Pars, etc.) using the conditional IIf function (this avoids use of VBA, per se)

Ultimately, your table design and form design should dictate your solution. You might want to elaborate as to how your tables are setup, because there's a smart way to do all this, and then there's the blockheaded way (mainly solutions 2 and 3, IMO).

Regards,
John
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:15
Joined
Feb 19, 2002
Messages
43,374
Not being a golfer I hate to jump in here but I will anyway because I'm married to one so I have acquired some domain knowledge by osmosis :) Do you have a database of golf courses with par defined for each hole? If you don't, you can't ever get a total number of strokes for any particular round. Since you're new to Access I'm also going to assume that you have made the typical mistake of designing a "flat" table structure. ie, you have one record with data for 18 holes. This "flat" structure is an incorrect design and will cause you a fair amount of trouble if you want to calculate any statistics.

Try something like the following:

tblCourse:
CourseID (autonumber primary key)
CourseName

tblCourseHoles:
CourseID (foreign key to tblCourse) (primary key field1)
HoleNum (primary key field2)
Par
LengthBlue
LengthWhite
LengthRed

tblRound:
RoundID (autonumber primary key)
RoundDate
CourseID (foreign key to tblCourse)

tblRoundHoles:
RoundID (foreign key to tblRound) (primary key field1)
HoleNum (primary key field2)
Score (enter numeric value 1-?)

Given this basic 4 table structure, you can calculate whatever you want via queries. With the flat structure, you would need to write lots of code to do any calculations.

To make a relational database work for you, you need to understand enough SQL to join tables together to get the information that you need.

Your data entry form will need to be a form with a subform for both the static course information and the transaction oriented round information.
 

Oldsoftboss

AWF VIP
Local time
Today, 18:15
Joined
Oct 28, 2001
Messages
2,499
Pat - I'm disappointed your not catering to your husbands EVERY need. You should realise that every golfer needs all the help they can get to improve their game;)

SirJones
Not knowing how much code you know I found this Db, but never got around to finishing it. Doesn't use much code and is only 9 holes but may give you a start. It's the flat table type that Pat so highly recommends;)
Dave
 

Attachments

  • golf.zip
    20.9 KB · Views: 426
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:15
Joined
Feb 19, 2002
Messages
43,374
After I answered this post yesterday, I spent some time talking to my husband about the possibilities and he gave me some web addresses for software. www.scorekeeper.com seemed to have a lot of features for not too much money.

The freebe that Oldsoftboss posted is a great example of really poor table design. Everything is hardcoded hole by hole and the original designer only put code in for the first few holes. Plus the code that is there doesn't work very well.

SiRJones, spend the $40 and buy the scorekeeper software. It sounds like it generates great stats.
 

Oldsoftboss

AWF VIP
Local time
Today, 18:15
Joined
Oct 28, 2001
Messages
2,499
Pat - Good to see you talking to your husband about golf !!
Dave
 

Users who are viewing this thread

Top Bottom