用sql函数
sql("数据库连接","XXXX docmentno='"+A1+"'",1,1)
‘“+A1+”’
还要用到sql函数
https://help.fanruan.com/finereport/doc-view-846.html