访问Excel的参数传递参数、Excel

2023-09-09 21:22:55 作者:踽踽独行

我在访问一个表,必须在Excel中访问。我可以轻松地建立它转储基于在VBA内特定细胞的整个表和筛选器,但因为我20,000记录它减缓了表的宏。

I have a table in access which has to be accessed in excel. I could easily set up a macro where it dumps the whole table and filters based on a particular cell within vba but since I have 20,000 records it slows up the sheet.

有没有传递参数的一个更快的方法?

Is there a faster way of passing parameter?

我尝试的方法是其中一个答案贴previously

The method I tried was one of the answers posted previously

•in Excel go to the data ribbon and click the From other sources icon
•click From Microsoft Query
•select MS Access Database* 
•browse for and select your database. 
•in the wizard select the columns you need to import
•on the next page select the column you want to filter on
•select the type of filter you need, i.e. Equals
•instead of selecting a value in the next box enter [Parameter please Bob]
•enter you sort on the next page
•select Return data to Microsoft Excel and finish

但我不知何故无法通过Excel单元格作为参数。我最终想获得在VBA这个运转,但试图找出如何工作进行手动操作。

But I am somehow not able to pass an excel cell as the parameter. I am ultimately trying to get this running in vba but trying to figure out how this works out manually.

任何帮助将是AP preciated。

Any help would be appreciated.

由于Aprough,然后通过你的程序,但无法选择的参数字段

Thanks Aprough, followed through your procedure but could not selects the Parameters field

推荐答案

一旦你拥有了一切设置,右键单击任意位置在返回的数据,然后选择参数。选择左侧的参数,然后选择从下面的单元格的值:,然后选择与您的参数的单元格。数据刷新每一次,它会使用该单元格作为参数值。这是怎么做到的手动

Once you have everything set up, right-click anywhere in your returned data and choose Parameters. Select your parameter on the left, and choose "Get the value from the following cell:" and then choose the cell with your parameter. Every time your data refreshes, it will use that cell as the parameter value. This is how you do it "manually"