murray83
Games Collector
- Local time
- Today, 07:27
- Joined
- Mar 31, 2017
- Messages
- 736
here is my code for starting my quiz, i have altered it as we had someone who shares a PC logon the SFM005.D002 so weren't able to take part when the other person had done so
so in my wisdom i changed the criteria and made it look for user name as well as PC login and quiz no, but this has also given raise to added side effect of allowing people to have multiple goes when i want to try and limit it to one go per question set
the issue i have now though is its throwing its code out the pram and giving me this message, see attached
below this code is the original code which hasnt been doctored by me
original code here
so in my wisdom i changed the criteria and made it look for user name as well as PC login and quiz no, but this has also given raise to added side effect of allowing people to have multiple goes when i want to try and limit it to one go per question set
the issue i have now though is its throwing its code out the pram and giving me this message, see attached
below this code is the original code which hasnt been doctored by me
Code:
Dim PlayerName As TempVars
Dim QRoundNo As TempVars
If Me.txtPCLogin.Value = "SFM005.D002" Then
If Me.txt_UserName <> "" Then 'checks wethere the persons name is in the table
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblLeaderBoard WHERE Person = '" & txt_UserName & "' AND UserID = '" & txtPCLogin & "' AND QuizNo = '" & QuestionRoundNo & "' ")
Else
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblLeaderBoard WHERE UserID = '" & txtPCLogin & "' AND QuizNo = '" & QuestionRoundNo & "' ")
rs.Requery
End If
End If
If rs.RecordCount < 1 Then
TempVars!PlayerName = Me.txt_UserName.Value
TempVars!QRoundNo = Me.QuestionRoundNo.Value
Me.Visible = False
DoCmd.OpenForm "frmQuestions", , , , , , Me.QuestionRoundNo
Else
MsgBox ("You Have Allready Taken Part") 'if they are says so and exits sub
txt_UserName.Value = ""
txt_UserName.SetFocus
cmd_Start.Enabled = False
Exit Sub
End If
original code here
Code:
Private Sub cmd_Start_Click()
Dim PlayerName As TempVars
Dim QRoundNo As TempVars
If Me.txt_UserName <> "" Then 'checks wethere the persons name is in the table
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblLeaderBoard WHERE Person = '" & txt_UserName & "' AND UserID = '" & txtPCLogin & "' AND QuizNo = '" & QuestionRoundNo & "' ")
rs.Requery
If rs.RecordCount < 1 Then
TempVars!PlayerName = Me.txt_UserName.Value
TempVars!QRoundNo = Me.QuestionRoundNo.Value
Me.Visible = False
DoCmd.OpenForm "frmQuestions", , , , , , Me.QuestionRoundNo
Else
MsgBox ("You Have Allready Taken Part") 'if they are says so and exits sub
txt_UserName.Value = ""
txt_UserName.SetFocus
cmd_Start.Enabled = False
Exit Sub
End If
End If
End Sub