title: select case and error join multiple table
body: <pre><code>Imports System.Data.OleDb
  Public Class Form1
      Dim conn As OleDbConnection
      Dim cmd As OleDbCommand
      Dim da As OleDbDataAdapter
      Dim strSQL As String
  
  
  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnsearch.Click
      Dim fieldselect As String = ""
  
      Select Case ComboBox1.Text
          Case "startYear"
              fieldselect = "startYear"
          Case "genres"
              fieldselect = "genres"
          Case "Rating"
              fieldselect = "Rating"
      End Select
  
  
      conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Movies.accdb; Persist Security Info=False;")
  
      strSQL = "SELECT startYear, genres, averageRating FROM (basic.tconst Inner JOIN Rating.tconst on basic.tconst=Rating.tconst)" &amp; fieldselect &amp; "'" &amp; TextBox1.Text &amp; "%'"
  
      conn.Open()
      da = New OleDbDataAdapter(strSQL, conn)
  
      Dim ds As New DataSet("Movies")
  
      da.Fill(ds, "Movies")
  
      DataGridView1.DataSource = ds.Tables("Movies")
      conn.Close()
  
  End Sub
  </code></pre>