ADO建新表带字符“-”时,产生实时错误'80004005',如何解决?
ADO建新表时,产生实时错误 '80004005 ',我写的语句如下:
AccCn.Execute "Select * Into " & newTable & " From old_Table Where False "
当newTable带字符“-”时,就产生“实时错误 '80004005 ',说没有指表名”,但是我在Access里可以建立带字符“-”表名可以啊,为什么产生这个就错误呢?
[解决办法]
用[]括起来看看
[解决办法]
colorslife(霜水茶) 已经正解.
加[]就可以了.例子如下
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & "d:\A.mdb "
'sql = "select * from test "
'rs.Open sql, conn, adOpenKeyset, adLockReadOnly
'rs.Close
conn.Execute "Select * Into " & "[teew-vye1] " & " From old_Table Where False "
conn.Close