如何在Excel VBA 2010中的变量中存储查询的值 [英] How to store values of a Query in a Variable in Excel VBA 2010

查看:111
本文介绍了如何在Excel VBA 2010中的变量中存储查询的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的员工表中我有100条记录





 Dim strCount As String 
strCount =从员工中选择计数(*)





在上面的代码中 strCount 存储完整的查询。



i只想在 strCount 计数(100) >变量,



如何存储



谢谢

解决方案

要解释很多事情,所以我建议你阅读以下文章:

^ ]

如何将ADO与Visual Basic或VBA中的Excel数据一起使用 [ ^ ]

In My Employee table i have 100 Records


Dim strCount As String
strCount= "select count(*) from employee"



In the above code strCount stores complete Query.

i just want to store the Count value(100) in My strCount variable,

How to store

Thank you

解决方案

To many things to explain, so i would suggest you to read below articles:
How to transfer data from an ADO Recordset to Excel with automation[^]
How To Use ADO with Excel Data from Visual Basic or VBA[^]


这篇关于如何在Excel VBA 2010中的变量中存储查询的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆