如何保存SQL查询作为VBA访问的结果?

时间:2019-03-21 10:03:33

标签: sql vba ms-access

嘿,我想将查询结果另存为vba中的字符串 但是我下面的代码保存了SQL语句,而不是结果:

Dim strModel As String
Dim strSQL As String
Dim rst As DAO.Recordset


 strSQL = "SELECT Distinct MID(WEI.LOR,1,3) as LKZ FROM WEI"
 Set rst = CurrentDb.OpenRecordset(strSQL)
 strModel = rst!LKZ
 rst.Close
 Set rst = Nothing

有人可以帮我吗?谢谢!

0 个答案:

没有答案