简体   繁体   English

使用Excel中的命名单元格值更新访问表rst

[英]Update access table rst with named cell values from excel

I have got a table in access that I loop through using a DAO recordset. 我有一个使用DAO记录集循环访问的表。 For every recordset I take a bunch of data to an excel spreadsheet and run it through a model in excel. 对于每个记录集,我将一堆数据带到excel电子表格中,并通过excel中的模型运行它。 This produces a bunch of results in excel which are calculated in named cells. 这会在Excel中产生一堆结果,这些结果是在命名单元格中计算的。

I want to be able to update the current recordset in access with these results but am having a tough time doing it. 我希望能够使用这些结果来更新访问中的当前记录集,但是这样做很困难。

I have the following code 我有以下代码

code to create a DAO recordset 创建DAO记录集的代码

code to move to first record 移至第一条记录的代码

code to parse data to excel 代码将数据解析为excel

code to run a bunch of stuff in excel including a goal seek to calculate results 代码来在excel中运行很多东西,包括目标以计算结果

next I use the follwoing code without success 接下来,我使用下面的代码没有成功

            With MyXL

            strSQL = "UPDATE ProductPricing SET Profit = " & .Names("Profit") & ";"

            End With

Code to move to next record and loop until EOF 代码移至下一条记录并循环直到EOF

Could you not try to keep everything in access and replicate the goal seeking using a user defined function? 您是否可以尝试使用用户定义的函数来保持所有内容的访问权限并复制目标搜索? Failing that I would keep the code in excel and get the code to “pull” the values into excel and then “push” them to access as opposed to pushing the data to excel and pulling it back 未能将代码保留在excel中并使代码将值“拉”入excel,然后“推”它们以进行访问,而不是将数据推入excel并将其拉回

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM