hello to each and everyone..can you help me,.. can you help me on how to add a VB code on my button...what i want to happen is that when i click the button(" Vote ").. the choosen candidate in the the combo box will increment by 1 ( +1 )....
i have created a table(tblcandidate) were candidateID(Primary key),firstname,lastname and vote.. what i want agen to happen is that when a voter click the button ("Vote")the value in the vote(on tblcandidate) will +1..here is my code on my button..i need more corrections:

Private Sub Form_Open(Cancel As Integer)
Me.Combo24.SetFocus
Me.Combo26.SetFocus
End Sub

Private Sub vote_Click()
On Error GoTo Err_vote_Click
Dim Votes As Long

If IsNull(Me.Combo24) Or Me.Combo24 = "" Then
            If MsgBox("Are you Sure to leave blank in President", vbYesNo + vbExclamation, "Required Data") = vbYes Then
            Cancel = True
            Me.Undo
            Me.Combo24.SetFocus
   Exit Sub
   End If
        Else
            If IsNull(Me.Combo24) Or Me.Combo24 = "Combo24" Then
            Votes = Nz(DLookup("candidateID", "candidate", "Votes=" & Me.vote), "")
             Votes = Votes + 1
            Me.Combo24.SetFocus
            Exit Sub
            End If
             DoCmd.GoToRecord , , acNewRec
            DoCmd.OpenForm "frmProgressBar", acNormal
        Exit Sub
    End If
If IsNull(Me.Combo26) Or Combo26 = "" Then
            If MsgBox("Are you Sure to leave blank in Vice-President", vbYesNo + vbExclamation, "Required Data") = vbYes Then
            Cancel = True
            Me.Undo
            Me.Combo26.SetFocus

    Else
        If IsNull(Me.Combo26) Or Me.Combo26 = "Combo26" Then
        Me.Combo26.SetFocus
        Votes = Nz(DLookup("candidateID", "candidate", "Votes=" & Me.vote), "")
         Votes = Votes + 1
        DoCmd.GoToRecord , , acNewRec
        DoCmd.OpenForm "frmProgressBar", acNormal
        Exit Sub
    End If
Exit_vote_Click:
    Exit Sub

Err_vote_Click:
    MsgBox Err.Description
    Resume Exit_vote_Click
    End If
End If
End Sub

hello to each and everyone..can you help me,.. can you help me on how to add a VB code on my button...what i want to happen is that when i click the button(" Vote ").. the choosen candidate in the the combo box will increment by 1 ( +1 )....
i have created a table(tblcandidate) were candidateID(Primary key),firstname,lastname and vote.. what i want agen to happen is that when a voter click the button ("Vote")the value in the vote(on tblcandidate) will +1..here is my code on my button..i need more corrections:

Private Sub Form_Open(Cancel As Integer)
Me.Combo24.SetFocus
Me.Combo26.SetFocus
End Sub

Private Sub vote_Click()
On Error GoTo Err_vote_Click
Dim Votes As Long

If IsNull(Me.Combo24) Or Me.Combo24 = "" Then
            If MsgBox("Are you Sure to leave blank in President", vbYesNo + vbExclamation, "Required Data") = vbYes Then
            Cancel = True
            Me.Undo
            Me.Combo24.SetFocus
   Exit Sub
   End If
        Else
            If IsNull(Me.Combo24) Or Me.Combo24 = "Combo24" Then
            Votes = Nz(DLookup("candidateID", "candidate", "Votes=" & Me.vote), "")
             Votes = Votes + 1
            Me.Combo24.SetFocus
            Exit Sub
            End If
             DoCmd.GoToRecord , , acNewRec
            DoCmd.OpenForm "frmProgressBar", acNormal
        Exit Sub
    End If
If IsNull(Me.Combo26) Or Combo26 = "" Then
            If MsgBox("Are you Sure to leave blank in Vice-President", vbYesNo + vbExclamation, "Required Data") = vbYes Then
            Cancel = True
            Me.Undo
            Me.Combo26.SetFocus

    Else
        If IsNull(Me.Combo26) Or Me.Combo26 = "Combo26" Then
        Me.Combo26.SetFocus
        Votes = Nz(DLookup("candidateID", "candidate", "Votes=" & Me.vote), "")
         Votes = Votes + 1
        DoCmd.GoToRecord , , acNewRec
        DoCmd.OpenForm "frmProgressBar", acNormal
        Exit Sub
    End If
Exit_vote_Click:
    Exit Sub

Err_vote_Click:
    MsgBox Err.Description
    Resume Exit_vote_Click
    End If
End If
End Sub

http://www.sharetermpapers.com/computer-scienceit/computerized-voting-system-mindanao-state-university-naawan/?PHPSESSID=bc64a777752a574be95c9051c081bc88

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.