Good morning, I just need you to help me with a code.
I need to make a voting system, I already have the table ready but my code does not do what I asked.
There are two questions:
A) How do I correctly validate that the user has checked a checkbox? B) How do I add a vote to the voter in question?
This is what I have so far:
-Code:
Private Sub Comando25_Click()
Check1 As Boolean
Check2 As Boolean
Check3 As Boolean
Check4 As Boolean
If Me.Check1 = True & Me.Check2 = True & Me.Check3 = True & Me.Check4 = True
Then
MsgBox "No puedes seleccionar los cuatro, solo puedes seleccionar uno"
DoCmd.Close
DoCmd.OpenForm "Ir a"
End If
If Me.Check1 = True & Me.Check2 = True & Me.Check3 = True Then
MsgBox "No puedes seleccionar tres, solo puedes seleccionar uno"
DoCmd.Close
DoCmd.OpenForm "Ir a"
End If
If Me.Check1 = True & Me.Check2 = True Then
MsgBox "No puedes seleccionar dos, solo puedes seleccionar uno"
DoCmd.Close
DoCmd.OpenForm "Ir a"
End If
If Me.Check2 = True & Me.Check3 = True Then
MsgBox "No puedes seleccionar dos, solo puedes seleccionar uno"
DoCmd.Close
DoCmd.OpenForm "Ir a"
End If
If Me.Check1 = True & Me.Check3 = True Then
MsgBox "No puedes seleccionar dos, solo puedes seleccionar uno"
DoCmd.Close
DoCmd.OpenForm "Ir a"
End If
End Sub
This is what the form looks like:
This is how the table looks: (Votes is a variable number, of course)
I await your response