我希望我的程序只显示数据库中的活跃学生。如果学生已存档为否,则显示它们,但如果学生有,则隐藏它们。每次我播放该节目时,它都会向我显示Adodc1.Refresh
:
FROM子句中的语法错误。
代码:
Dim sql As String
connSearch.Open connstr
Adodc1.ConnectionString = conn.connstr
sql = "select * from Table1 where [Archived] <> 'NO'"
Adodc1.RecordSource = sql
Set StudentTable.DataSource = Adodc1
Adodc1.Refresh ''''The error is in this line.''''
Adodc1.Visible = False
答案 0 :(得分:1)
我修复了问题,我需要在代码中使用 adcmdText 才能使用它。谢谢你的Microsoft帮助https://support.microsoft.com/en-us/kb/238279
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