从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
最满意答案
这是事情:
iframe.onload = function() { this.somefunction();}
现在,
this
不是指向你的Service类,但它实际上是指向匿名函数,所以要么必须将它绑定到匿名函数作用域,所以this.somefunction引用类方法而不是帧参数特定属性(不存在),或者使用胖箭头函数,因为胖箭头函数引用词法范围而不是局部函数范围。iframe.onload = () => this.somefunction()
应该这样做。
Here's the thing:
iframe.onload = function() { this.somefunction();}
Now,
this
is not pointing to your Service class, but it's actually pointing to the anonymous function, so either you have to bindthis
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来访问 ...
-
iframe onload事件(iframe onload event)[2022-05-05]
我不知道它为什么加载两次,但你可以,而不是在onLoad ,使用jQuery: jQue ... -
尝试 app.controller('MainCtrl', () => { var iFrame = angular.element('') angular.element(document.body).append(iFrame); // onload bind here var url = 'test.txt'; iFrame.attr('src', url); iFrame.on('load', event => ...
-
“访问被拒绝”当尝试访问以编程方式创建的文档对象[2022-04-22]
如果在父页面中设置了document.domain属性,Internet Explorer会给我一个“访问被拒绝” 叹。 是的,这是一个IE问题(错误,很难说,因为这种不愉快没有文件标准)。 当您创建srcless iframe时,它会从父文档的location.host而不是其document.domain接收document.domain 。 在这一点上,你几乎失去了,因为你不能改变它。 一个可怕的解决方法是将src设置为javascript:URL(urgh!): iframe.src= "java ... -
来自iframe的AJAX请求,为什么源是父的URL?(AJAX request from iframe, why is the origin the parent's URL?)[2021-12-17]
好, 你不能。 这样做实际上是跨域执行,这是一个巨大的安全风险。 因此,大多数现代浏览器都会跟踪您脚本的原始入口点,并看到它是从不同的域加载的。 如果你想这样做: 从iFrame域加载JavaScript 定义一个对象(让我们说'window.iframeparams) 填充它 在从iframe域加载的JavaScript代码上调用“send” 它实际上与谷歌分析或任何其他跟踪软件相同 编辑: 同样, 浏览器将跟踪呼叫的来源 。 因此,通过创建动态iFrame的方法将无效(或者可能在ie6上) Well, ... -
好吧,我终于找到了解决方案(虽然欢迎解释)。 我不得不将iframe的javascript放在内联的 已经成为: