使用的SendKeys通过Access报告如何点击 [英] How to click through Access Report using SendKeys

查看:425
本文介绍了使用的SendKeys通过Access报告如何点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

完成创建表的内容对我的访问报告已经步履维艰后,我终于读懂了其中code的工作点,并创建一个目录。

随着说明,我需要手动点击通过打印preVIEW直到使创建TOC的最后一页。这工作。

使用的SendKeys通过访问报告如何我点击?

下面是我的code那么远,它完美的作品,除了的SendKeys什么也不做!

 ,这样的TOC code执行点击率报告
昏暗rptCurReport作为报告
设置rptCurReport = Screen.ActiveReport

随着rptCurReport
    Application.DoCmd.SelectObject acReport,rptFundSelectionList
    。可见= true开关设置为false,一旦code是OK
    通过所有页面
    对于i = 1到.Pages
        的SendKeys{}下页,真
    接下来我

    DoCmd.Close acReport,rptFundSelectionList
结束与
 

解决方案

我设法最终解决这个问题我自己。这里是code。愿它帮助其他一些可怜的灵魂!

 包含code与ISINs从上面的列表中创建TOC打开报告
DoCmd.OpenReportrptFundSelectionList,acView preVIEW,strWhere
设置字典=什么

使TOC code为执行点击率报告
昏暗rptCurReport作为报告
设置rptCurReport = Screen.ActiveReport

随着rptCurReport
    Application.DoCmd.SelectObject acReport,.Name点
    。可见= true开关设置为false,一旦code是OK
    通过所有页面
    的SendKeys{}完,真
    的DoEvents
    Application.DoCmd.SelectObject acReport,.Name点
    DoCmd.Close acReport,.name和acSaveNo
结束与
 

After having slogged through creating a table of contents for my access report, I have finally gotten to the point where the code works, and a table of contents is created.

As the instructions from Microsoft state, I need to manually click through the Print Preview until the last page so that the TOC is created. This works.

How can I click through the Access Report using SendKeys?

Here is my code so far... it works perfectly, except that SendKeys does nothing!

'Click through report so that TOC code is executed
Dim rptCurReport As Report
Set rptCurReport = Screen.ActiveReport

With rptCurReport
    Application.DoCmd.SelectObject acReport, "rptFundSelectionList"
    .Visible = True 'switch to false once code is ok
    'go through all pages
    For i = 1 To .Pages
        SendKeys "{PGDN}", True
    Next i

    'DoCmd.Close acReport, "rptFundSelectionList"
End With

解决方案

I have managed to finally solve this issue for myself. Here is the code. May it help some other poor soul!

'Open report containing code to create TOC with list of ISINs from above
DoCmd.OpenReport "rptFundSelectionList", acViewPreview, , strWhere
Set dict = Nothing

'Click through report so that TOC code is executed
Dim rptCurReport As Report
Set rptCurReport = Screen.ActiveReport

With rptCurReport
    Application.DoCmd.SelectObject acReport, .Name
    .Visible = True 'switch to false once code is ok
    'go through all pages
    SendKeys "{End}", True
    DoEvents
    Application.DoCmd.SelectObject acReport, .Name
    DoCmd.Close acReport, .Name, acSaveNo
End With

这篇关于使用的SendKeys通过Access报告如何点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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