首页 \ 问答 \ 从MS Access窗体中的动态列表框创建新的Excel电子表格(Creating a New Excel Spreadsheet from a Dynamic Listbox in an MS Access Form)

从MS Access窗体中的动态列表框创建新的Excel电子表格(Creating a New Excel Spreadsheet from a Dynamic Listbox in an MS Access Form)

我有一个基于MS Access表单的搜索引擎。 表单使用ListBox(“List1”)显示基于关键字搜索的结果。 我想创建一个按钮(“Command47”),它将在新的Excel电子表格中显示列表框的结果。 我不想将文件保存到文件路径,只是想让它打开。 以下是我目前的情况:

Private Sub Command47_Click()

      Dim qdef As DAO.QueryDef

      Set qdef = CurrentDb.CreateQueryDef("VFE")

      qdef.SQL = Me.List1.RowSource

      qdef.Close

      Set qdef = Nothing

      CurrentDb.QueryDefs.Delete "VFE"

End Sub

需要知道从哪里开始。


I have a search engine built on a form in MS Access. The form uses a ListBox ("List1") to show results based on a keyword search. I wanted to create a button ("Command47") that will show results of listbox in a new excel spreadsheet. I do not want to save the file to a filepath, just want it to open. Below is what I currently have:

Private Sub Command47_Click()

      Dim qdef As DAO.QueryDef

      Set qdef = CurrentDb.CreateQueryDef("VFE")

      qdef.SQL = Me.List1.RowSource

      qdef.Close

      Set qdef = Nothing

      CurrentDb.QueryDefs.Delete "VFE"

End Sub

Need to know where to go from here.


原文:https://stackoverflow.com/questions/36776477
更新时间:2021-08-05 09:08

最满意答案

这是事情:

iframe.onload = function() { this.somefunction();}

现在, this不是指向你的Service类,但它实际上是指向匿名函数,所以要么必须将它绑定到匿名函数作用域,所以this.somefunction引用类方法而不是帧参数特定属性(不存在),或者使用胖箭头函数,因为胖箭头函数引用词法范围而不是局部函数范围。

iframe.onload = () => this.somefunction()

应该这样做。


Here's the thing:

iframe.onload = function() { this.somefunction();}

Now, thisis not pointing to your Service class, but it's actually pointing to the anonymous function, so either you have to bind this to the anonymous function scope, so this.somefunction refers to the class method instead to an inframe specific property (that doesn't exist), or use a fat arrow function instead, since the fat arrow functions refer to the lexical scope instead of local function scope.

iframe.onload = () => this.somefunction()

That should do it.

相关问答

更多
  • 您正在声明父页面中的所有内容。 所以对window和document的引用是对父页面的引用。 如果你想对iframe做些什么,请使用iframe || iframe.contentWindow iframe || iframe.contentWindow来访问它的window ,以及iframe.contentDocument || iframe.contentWindow.document iframe.contentDocument || iframe.contentWindow.document来访问 ...
  • 我不知道它为什么加载两次,但你可以,而不是在onLoad ,使用jQuery: jQue ...
  • 尝试 app.controller('MainCtrl', () => { var iFrame = angular.element('