Private Sub GetQuestion()
Dim dbs As DAO.Database, rst As DAO.Recordset, x As Integer
Set dbs = CurrentDb
Me.WMPQuizVid.Visible = False
Me.WMPQuizVid.URL = ""
Me.QImage.Visible = False
Me.Question.Width = 6804 'Set the full width of the question box
'Me.GotoNextQuestion.Enabled = False
'Me.FiftyFifty.Enabled = True
'Get the question and choices from the tables according to the question round number and question number
Set rst = dbs.OpenRecordset("SELECT tblQuestionChoice.ChoisePicture, tblQuestions.QRoundNo, tblQuestions.QuestionNo, Question, ChoiseNo, Choise, RightAnswer, ImageAttached, VideoAttached " _
& "FROM tblQuestions INNER JOIN tblQuestionChoice ON (tblQuestions.QuestionNo = tblQuestionChoice.QuestionNo) AND (tblQuestions.QRoundNo = tblQuestionChoice.QRoundNo) " _
& "WHERE tblQuestions.QRoundNo=" & TempVars!QRoundNo & " AND tblQuestions.QuestionNo=" & RememberQuestionNo & ";")
If Not rst.EOF Then 'Is some data found?
'Yes data found, then prepare the form
Me.Caption = "Question " & rst![QuestionNo] 'Set the form's caption
Me.QuestionNo.Caption = Me.Caption 'Set the QuestionNo (label) caption
Me.Question = rst![Question] 'Set the Question
If Not IsNull(rst![ImageAttached]) Then 'Some picture is attached to the question
'Me.Question.Width = 4479 'Reduce the width of the question box so the picture box not covered some of the question
Me.QImage.Visible = True 'Show the picture box
Me.QImage.Picture = rst![ImageAttached] 'Put the picture in the picture box
End If
'for video attempt
If Not IsNull(rst![VideoAttached]) Then 'Some video is attached to the question
'Me.Question.Width = 4479 'Reduce the width of the question box so the video box not covered some of the question
Me.WMPQuizVid.Visible = True 'Show the video box
Me.WMPQuizVid.uiMode = "none" 'trying to hide play back buttons
Me.WMPQuizVid.URL = rst![VideoAttached] 'Put the video in to play ?
End If
For x = 1 To 4 'Prepare the 4 choises button
Me("Choise" & x).Visible = True 'Make the button visible
Me("Choise" & x).Enabled = True 'Make the button enable
Me("Choise" & x).Picture = Nz(rst![ChoisePicture], "") ' To put a picture in the button - added by me as suggested by theDBguy
Me("Choise" & x).Caption = Nz(rst![Choise], "") 'Put the choise in the button's caption
Me("Choise" & x).Tag = rst![RightAnswer] 'Mark the button as right or wrong choise
rst.MoveNext
Next x
Else
Me.Visible = False
MsgBox ("Sorry, no more questions!") 'Question round is finish
Me.TimerInterval = 0 'should stop the timer on the results page so doesent keep counting up
DoCmd.OpenForm "F_Results"
Forms!F_Results.Refresh
Forms!F_Results!txtSecondsTaken.Value = txtYouHaveTaken.Value
End If
End Sub