Dutch4coke
Nieuwe gebruiker
- Lid geworden
- 7 dec 2010
- Berichten
- 1
Met een schoolopdracht moeten we Yahtzee maken in word of acces, nu werkte gisteren het programma nog kreeg ik vandaag een foutmelding de me. *code* niet werkt. Ik heb echter geen idee hoe ik deze foutcode kan oplossen. Ik hoop dat iemand me hiermee kan helpen 
Het is in een Acces bestand, ik kon hem hier echter niet uploaden omdat het bestand groter is dan 100kb dus heb ik hem via rapidshare geupload
http://rapidshare.com/files/435525234/Yahtzee.zip
Ik hoop dat iemand mij kan helpen :thumb:
Groetjes, Chrisje

Code:
Dim Teller, getallen, score As Integer
Dim steen(4) As Integer
Option Compare Database
Private Sub Chance_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Chance2.Caption = "0") Then
Dim count As Integer
Dim valid As Boolean
steen(0) = Me.Steen1.Caption
steen(1) = Me.Steen2.Caption
steen(2) = Me.Steen3.Caption
steen(3) = Me.Steen4.Caption
steen(4) = Me.steen5.Caption
For i = 1 To 6
count = 0
For d = 0 To 4
If (steen(d) = i) Then
count = count + 1
End If
Next d
If (count = 0) Then
valid = True
End If
Next i
If (valid = True) Then
score = score + steen(0)
score = score + steen(1)
score = score + steen(2)
score = score + steen(3)
score = score + steen(4)
Me.Chance2.Caption = score
score = 0
Reset2
End If
End If
End If
End Sub
Sub yahtzee2_click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Yahtzee111.Caption = "0") Then
Dim count As Integer
Dim valid As Boolean
steen(0) = Me.Steen1.Caption
steen(1) = Me.Steen2.Caption
steen(2) = Me.Steen3.Caption
steen(3) = Me.Steen4.Caption
steen(4) = Me.steen5.Caption
For i = 1 To 6
count = 0
For d = 0 To 4
If (steen(d) = i) Then
count = count + 1
End If
Next d
If (count > 4) Then
valid = True
End If
Next i
If (valid = True) Then
score = score + steen(0)
score = score + steen(1)
score = score + steen(2)
score = score + steen(3)
score = score + steen(4)
Me.Yahtzee111.Caption = score
score = 0
Reset2
End If
End If
End If
End Sub
Private Sub FullHouse_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.FH2.Caption = "0") Then
Dim count As Integer
Dim valid As Boolean
steen(0) = Me.Steen1.Caption
steen(1) = Me.Steen2.Caption
steen(2) = Me.Steen3.Caption
steen(3) = Me.Steen4.Caption
steen(4) = Me.steen5.Caption
For i = 1 To 6
count = 0
For d = 0 To 2
If (steen(d) = i) Then
count = count + 1
End If
Next d
If (count > 2) Then
valid = True
End If
If (count > 1) Then
valid = True
End If
Next i
If (valid = True) Then
score = score + steen(0)
score = score + steen(1)
score = score + steen(2)
score = score + steen(3)
score = score + steen(4)
Me.FH2.Caption = score
score = 0
Reset2
End If
End If
End If
End Sub
Private Sub threeofakind_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Toak2.Caption = "0") Then
Dim count As Integer
Dim valid As Boolean
steen(0) = Me.Steen1.Caption
steen(1) = Me.Steen2.Caption
steen(2) = Me.Steen3.Caption
steen(3) = Me.Steen4.Caption
steen(4) = Me.steen5.Caption
For i = 1 To 6
count = 0
For d = 0 To 4
If (steen(d) = i) Then
count = count + 1
End If
Next d
If (count > 2) Then
valid = True
End If
Next i
If (valid = True) Then
score = score + steen(0)
score = score + steen(1)
score = score + steen(2)
score = score + steen(3)
score = score + steen(4)
Me.Toak2.Caption = score
score = 0
Reset2
End If
End If
End If
End Sub
Private Sub Carre_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Carre2.Caption = "0") Then
Dim count As Integer
Dim valid As Boolean
steen(0) = Me.Steen1.Caption
steen(1) = Me.Steen2.Caption
steen(2) = Me.Steen3.Caption
steen(3) = Me.Steen4.Caption
steen(4) = Me.steen5.Caption
For i = 1 To 6
count = 0
For d = 0 To 4
If (steen(d) = i) Then
count = count + 1
End If
Next d
If (count > 3) Then
valid = True
End If
Next i
If (valid = True) Then
score = score + steen(0)
score = score + steen(1)
score = score + steen(2)
score = score + steen(3)
score = score + steen(4)
Me.Carre2.Caption = score
score = 0
Reset2
End If
End If
End If
End Sub
Private Sub Een_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Een2.Caption = "0") Then
If Steen1.Caption = 1 Then score = score + 1
If Steen2.Caption = 1 Then score = score + 1
If Steen3.Caption = 1 Then score = score + 1
If Steen4.Caption = 1 Then score = score + 1
If steen5.Caption = 1 Then score = score + 1
Me.Een2.Caption = score
score = 0
Reset2
End If
End If
End Sub
Private Sub Twee_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Twee2.Caption = "0") Then
If Steen1.Caption = 2 Then score = score + 2
If Steen2.Caption = 2 Then score = score + 2
If Steen3.Caption = 2 Then score = score + 2
If Steen4.Caption = 2 Then score = score + 2
If steen5.Caption = 2 Then score = score + 2
Me.Twee2.Caption = score
score = 0
Reset2
End If
End If
End Sub
Private Sub Drie_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Drie2.Caption = "0") Then
If Steen1.Caption = 3 Then score = score + 3
If Steen2.Caption = 3 Then score = score + 3
If Steen3.Caption = 3 Then score = score + 3
If Steen4.Caption = 3 Then score = score + 3
If steen5.Caption = 3 Then score = score + 3
Me.Drie2.Caption = score
score = 0
Reset2
End If
End If
End Sub
Private Sub Vier_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Vier2.Caption = "0") Then
If Steen1.Caption = 4 Then score = score + 4
If Steen2.Caption = 4 Then score = score + 4
If Steen3.Caption = 4 Then score = score + 4
If Steen4.Caption = 4 Then score = score + 4
If steen5.Caption = 4 Then score = score + 4
Me.Vier2.Caption = score
score = 0
Reset2
End If
End If
End Sub
Private Sub Vijf_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.Vijf2.Caption = "0") Then
If Steen1.Caption = 5 Then score = score + 5
If Steen2.Caption = 5 Then score = score + 5
If Steen3.Caption = 5 Then score = score + 5
If Steen4.Caption = 5 Then score = score + 5
If steen5.Caption = 5 Then score = score + 5
Me.Vijf2.Caption = score
score = 0
Reset2
End If
End If
End Sub
Private Sub Zes_Click()
If (Me.Steen1.Caption <> "0") Then
If (Me.zes2.Caption = "0") Then
If Steen1.Caption = 6 Then score = score + 6
If Steen2.Caption = 6 Then score = score + 6
If Steen3.Caption = 6 Then score = score + 6
If Steen4.Caption = 6 Then score = score + 6
If steen5.Caption = 6 Then score = score + 6
Me.zes2.Caption = score
score = 0
Reset2
End If
End If
End Sub
Private Sub Gooien_Click()
Dobbel
End Sub
Sub Dobbel()
If (Teller < 3) Then
If Me.S1.Value = False Then
Me.Steen1.Caption = (Int(Rnd * 6) + 1)
End If
If Me.S2.Value = False Then
Me.Steen2.Caption = (Int(Rnd * 6) + 1)
End If
If Me.S3.Value = False Then
Me.Steen3.Caption = (Int(Rnd * 6) + 1)
End If
If Me.S4.Value = False Then
Me.Steen4.Caption = (Int(Rnd * 6) + 1)
End If
If Me.S5.Value = False Then
Me.steen5.Caption = (Int(Rnd * 6) + 1)
End If
Teller = Teller + 1
End If
If Teller = 3 Then
MsgBox "U mag niet meer gooien, maak een keus om je stenen te lossen."
End If
End Sub
Private Sub reset_Click()
vraag = "Wilt u opnieuw beginnen?"
Stijl = vbYesNo + vbDefaultButton2 + vbExclamation
Titelbalk = "Reset!"
Keuze = MsgBox(vraag, Stijl, Titelbalk)
If yes Then
ResetAll
End If
End Sub
Sub ResetAll()
Teller = 0
Me.S1.Value = False
Me.S2.Value = False
Me.S3.Value = False
Me.S4.Value = False
Me.S5.Value = False
Me.Steen1.Caption = 0
Me.Steen2.Caption = 0
Me.Steen3.Caption = 0
Me.Steen4.Caption = 0
Me.steen5.Caption = 0
Me.Een2.Caption = 0
Me.Twee2.Caption = 0
Me.Drie2.Caption = 0
Me.Vier2.Caption = 0
Me.Vijf2.Caption = 0
Me.zes2.Caption = 0
Me.Toak2.Caption = 0
Me.Carre2.Caption = 0
Me.FH2.Caption = 0
Me.Kleine2.Caption = 0
Me.Grote2.Caption = 0
Me.Yahtzee111.Caption = 0
Me.Chance2.Caption = 0
End Sub
Sub Reset2()
Teller = 0
Me.S1.Value = False
Me.S2.Value = False
Me.S3.Value = False
Me.S4.Value = False
Me.S5.Value = False
Me.Steen1.Caption = 0
Me.Steen2.Caption = 0
Me.Steen3.Caption = 0
Me.Steen4.Caption = 0
Me.steen5.Caption = 0
End Sub
Het is in een Acces bestand, ik kon hem hier echter niet uploaden omdat het bestand groter is dan 100kb dus heb ik hem via rapidshare geupload

http://rapidshare.com/files/435525234/Yahtzee.zip
Ik hoop dat iemand mij kan helpen :thumb:

Groetjes, Chrisje