Private Sub ComboBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Click
cmd2 = New OleDb.OleDbCommand("Select [Member_Id] From Member_Details EXCEPT select [M_Ids] from Books_Issue", cn)
' cmd2 = New OleDb.OleDbCommand(" Select Member_Id From Member_Details LEFT JOIN Books_Issue ON Member_Id =M_Ids Where ((M_Ids) Is Null)", cn)
da = New OleDbDataAdapter(cmd2)
ds = New DataSet
da.Fill(ds, "Members")
With Me.ComboBox1
ComboBox1.DataSource = ds.Tables(0)
ComboBox1.DisplayMember = "Member_Id"
End With
End Sub
You're Query is just wrong. 'Except' doesn't exist in MS ACCESS. You can easily avoid the usage of Except with the following structure:
Select *
from tableA
where NOT EXISTS
...
Or
Select *
from tableA
where NOT IN
...
In your Case (if M_Ids is the same type as Member_ID):
Select [Member_Id] From Member_Details md
WHERE NOT EXISTS
(select [M_Ids] from Books_Issue WHERE [M_Ids] = md.[Member_ID])