title: How to randomly select multiple choice questions from Access database
body: <p>I have an Access Database containing about 30 questions. The database is divided in 3 tables; Questions, Possible Answers and Answer.
  The questions have from 2 to 5 possible answers.
  How can I randomly select 10 questions from my database and add them to my vb form?</p>
  
  <p>PS: This is my first time doing this</p>
  
  <p>Here is my code </p>
  
  <p><code>
          Dim provider As String
          Dim dataFile As String
          Dim connString As String
          Public myConnection As OleDbConnection = New OleDbConnection
          Public dr As OleDbDataReader</p>
  
  <pre><code>Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
      provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source ="
      dataFile = "C:\Users\Phil\Desktop\Questions.accdb"
      connString = provider &amp; dataFile
      myConnection.ConnectionString = connString
      myConnection.Open()
      Dim str As String
      str = "SELECT Top 10 ID_Question From Questions ORDER BY RND(ID_Question)"
      Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)
      dr = cmd.ExecuteReader
  
    While dr.Read()
          TextBox1.Text = dr("ID_Question").ToString
    End While
      myConnection.Close()
      MsgBox("fsafa")
  End Sub
  </code></pre>
  
  <p></code></p>
  
  <p>The Textbox does not change and the msgBox does not show</p>
  
  <hr>
  
  <p><strong>Solution that worked for me if anyone is interested</strong></p>
  
  <pre><code>SELECT Top 10 ID_Question, Question_Name 
  FROM tblQuestions 
  ORDER BY RND(-(100000*ID_Question)*Time())
  </code></pre>