I am trying to display students in a datagrid that have "yes" as active. If the student has "no" as active, the form has to hide it and only show the students with "yes".
The problem that I am recieving now is
Syntax error in FROM clause.
Private Sub Form_Load()
Dim sql As String
Adodc1.ConnectionString = conn.connstr
sql = "select * from Table1 where Active <>" & "'No'"
Adodc1.RecordSource = sql
Set StudentTable.DataSource = Adodc1
Adodc1.Visible = False
Boolean data type (Yes/No), it's optional values are
False. In that case your query is:
"select * from Table1 where Active <> False"
String data type; are
'No' the same values? you are better converting all to lower or upper case:
"select * from Table1 where Ucase(Active) <> 'NO'"
Edit: Modified Code
Dim sql As String sql = "select * from Table1 where [Active] <> 'No'" Adodc1.ConnectionString = conn.connstr Adodc1.CommandType = adCmdText Adodc1.RecordSource = sql Set StudentTable.DataSource = Adodc1 Adodc1.Refresh Adodc1.Visible = False