Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    11

    Unanswered: Voting Application!

    Hi all,

    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.

  2. #2
    Join Date
    Jan 2003
    Posts
    56
    Quote Originally Posted by kingston19
    Hi all,

    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.

    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?

  3. #3
    Join Date
    Dec 2005
    Posts
    11
    When a voter recieves ten votes he/she is elected.

    as there are one vote per voter only 3 candidates and 20 voters.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    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)
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •