sql server - Error on opening qd.openrecordset -
what wrong in sample ? breaks indicated, while tbl name provided 1 of working linked table.
sub showlinked(tbl string) 'tbl name of existing local linked table (sql server)' dim db dao.database, rs dao.recordset dim qd querydef set db = currentdb db.tabledefs(tbl) debug.print .name, .sourcetablename, .connect set qd = db.createquerydef("") qd.connect = .connect qd.sql = "select 1 xxx " & .sourcetablename qd.returnsrecords = true set rs = qd.openrecordset() 'breaks here: error 3146 - "odbc--call failed" debug.print "test connection:", rs.fields(0) end end sub
found culprit: testing function on access table called data_archive_transaction
, sourcetablename
data_archive.transaction
(not name, promise).
since transaction
reserved word, in select must surrounded brackets: data_archive.[transaction]
.
tried table more normal name , worked fine.
Comments
Post a Comment