Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes

Status
Not open for further replies.

entwistle18

Technical User
Apr 29, 2004
16
GB
Hi all this is my first post.

I have designed at football club database for my friend and have I slight problem with a check box.

On the match form it contains details of who, when, where the club played a match. On this form I also have a sub form to allow a match day team to be entered. It is limited to sixteen players. I record whether the player played, was a substitute, received a yellow card, received a red card, and was the man of the match. These are all recorded by check boxes.
The problem I have is that I only want one of the 16 records to be the man of the match. At the moment everyone can be man of the match.

I hope I have described my problem so that it is understandable. Any suggestions???

Many thanks in advance
 
You could put the Man of the Match checkboxes into a controls group. I think this would do what you want.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Could you tell me how to put the man of match checkboxes into a control group
 
Sorry, I meant Option Group. On the tool bar, select the Options Group button. Click and drag on the form to create a box for your checkboxes. When the wizard opens, answer the questions.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
I dont think i need an option group. because
Each player who plays in the match has the choice to tick the man of match field. This means that they could be 16 records which have the man of match field ticked. I want the system to allow only one record to have the man of match field ticked.

I think i need coding which says if manofmatch = true then no one else can be man of match

i hope this helps
 
That is essentially what the Option Group does. If you check one checkbox in the option group, none of the others can be checked.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
What version of Access?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Sorry its me. I did not select the correct option. Found it now.
Could you make some suggestions about what i should do with the wizard
 
I would name the options using the same convention as you use on other objects whatever that is. I would not tell it to have a default value checked. I would leave the option values the way they are unless you specifically think it would be better to have them be something else(maybe the players jersey number). Select checkbox for the option type.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
i will try that. Thanks for your help
i have to go now i will let you know in 3 or so hours
 
Thanks TomThumbKP

Sorry in such a delay in replying. I have tried that method and it does not work. If select yes then all the boxes say yes. Is there any other suggestions.

All i want is one player of a squad of 16 players to be the man of the match. Once a player is chosen to be man of the match i want no other player to be allowed to be man of the match.
 
In the event that checks the check box (OnCheck maybe?), you need to write a validation code that makes sure none of the other check boxes in this section of the form are checked. If one's already checked then don't allow the others. This is at the form level, not the table level.

HTH

leslie
 
I don't know what to say. It works for me. Here is what I do:

In form design, I select the Option Group tool.
I drew a vertical rectangle on my form to hold my checkboxes.
The Option Group Wizard started.
On the first page of the wizard, I entered three names for my checkboxes. Check1, Check2, and Check3.
Clicked Next.
Selected 'No, I don't want a default.'
Clicked on Next.
I left the default checkbox values as they were thus:
Check1 = 1
Check2 = 2
Check3 = 3
Clicked Next.
Selected Checkbox for the control type.
Clicked on Next.
Changed the caption to 'OG1'
Clicked on Finish.
Put the form into View mode.
When I check one checkbox, only one is checked. If I click on another one, the first one is cleared so that no matter what I do, only one is checked.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Hi LesPaul,

I think that is what i need. I have produced code for another field. It checks whether a player played in a match or was a sub in a match.

Private Sub Apps_Click()
If Me.SubApps = True Then
MsgBox "You cannot be a player if you are a sub!"
Me.Apps = False

DoCmd.CancelEvent
End If
End Sub

I have tried putting similar code into mom_click but i cant get it to work. Any Suggestions

PS tomthumb i will try your instructions
 
LesPaul's solution will work and it is how I handle exclusivity for checkboxes on HTML pages, but It should be more effort than what is needed since the Option Group control was created specifically for this issue.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
What happens when i make that option group is on every record it will be the same.
e.g Player 1 yes
player 2 yes
and so on
what i want is something like this
player 1 no
player 2 no
player 3 yes
player 4 no
player 5 no

i think the coding way will work. any suggestions for the code

Thanks for your help
 
Following the above directions for creating an option group resulted in all items being checked at the same time?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Your method works the way you have stated but it does not do what i want.
I have 16 records on a subform. i want 1 0f those 16 records to be man of the match the form is set out like this

P= Played
S= Sub
Y= Yellow Card
R= Red Card
M= Man of the match
P S Y R M
Player1 YES NO YES NO NO
player2 YES NO NO NO YES
Player3 YES NO NO NO NO
player4 NO YES NO YES YES

and so on till all 16 players are recorded
I just want the M to allow 1 man of the match
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top