var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Voting Application!
Im creating a voting application at the mo.
I have a form on which the user enters "voterid" "candidateid" and "Electionyear".
I have a numVotes section in tblCandidate but the max votes that i want is ten for each candidate.
Is there code to inform a voter that the quota has been reached when they press "cmdVote". i.e when the candidate has recieved ten votes.
Originally Posted by kingston19
why would you want to stop the voter placing a vote? Would ten votes not be the quota that a candidate could acheieve or exceed?
When a voter recieves ten votes he/she is elected.
as there are one vote per voter only 3 candidates and 20 voters.
It is generally poor practice to store derived data. You can derive the number of votes for a given candidate by querying the table you store your votes in and grouping by candidate id...
That said, you can use DLookup() to return the value of any field from a table. Might look something like this:
DLookup("[numVotes]", "[tblCandidate]", "candidate_id = " & YourCandidateId)
with a little bit more flexible design, you would probably want to go with DCount:
DCount("[vote_id]", "[tblVotes]", "[cadidate_id] = " & YourCandidateId)