访问vba中的自动化错误

我使用下面的代码来进行连接和执行查询,但它不能正常工作,它显示“Auomation错误未指定的错误”的代码是:

On Error GoTo err DoCmd.Hourglass (True) 'For Report file Name Dim rs As New ADODB.Recordset Dim strReportFileName As String Dim rsReportFileName As New ADODB.Recordset strReportFileName = "" Set con = Application.CurrentProject.Connection sSql = "" sSql = "SELECT * from tblInputFile as input inner join tblAccountMst as actmaster on input.Account=actmaster.AccountAsPerBOI" If rs.State = 1 Then rs.Close rs.Open sSql, con, adOpenKeyset, adLockOptimistic **'on this line i get the error and it goes to catch block** If rs.RecordCount > 0 Then If FE.FolderExists(Application.CurrentProject.Path & "\Reports\") = False Then FE.CreateFolder (Application.CurrentProject.Path & "\Reports\") End If err: MsgBox "Error " & err.Description DoCmd.Hourglass (False) 

请在Access VBA中帮助im初学者。 提前致谢

INPUT是Access SQL中的保留字,请参见此处或此处

把它放在方括号内

 sSql = "SELECT * from tblInputFile as [input] inner join tblAccountMst as actmaster on [input].Account=actmaster.AccountAsPerBOI" 

或更好:使用不同的别名。