[英]How can I put SQL result into variable in VBA
I have example table like below我有如下示例表
| ID | Qty |
| -- | ----|
| 1 | 5 |
| 2 | 7 |
| 3 | 8 |
| 4 | 9 |
| 5 | 12 |
How can I pass result of below query into VBA variable to use in next queries (update and insert)?如何将以下查询的结果传递给 VBA 变量以在下一个查询(更新和插入)中使用?
SELECT example_tab.Qty
FROM example_tab
WHERE ID = 4
In example that test_variable = 9例如 test_variable = 9
Is this what your looking for?这是你要找的吗?
sSQL = "SELECT example_tab.Qty FROM example_tab WHERE ID = 4"
Dim rs As DAO.Recordset
Set rs = CurrentDB.OpenRecordset(sSQL)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.