⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 138.txt

📁 VB文章集(含API、窗口、数据库、多媒体、系统、文件、等等)
💻 TXT
字号:
在VB中运行Microsoft Access报表的好方法 



  在VB中如何使用直观、简便的报表一直是很多人关心的问题, Crystal Reports用起来又不太理想。现介绍一在VB中运行Microsoft Access报表的方法,用起来还不错。 

  利用Automation运行Microsoft Access报表 

1. 使用Microsoft Access建立数据库(如:novelty.mdb)的相关报表(如:rptEmployess)。 

2. 创建引用 

  在VB中使用“Project References"菜单创建一个对Microsoft Access 8.0 Object Library 

的引用。 

3. 程序清单 

注释:References MS Access 8.0 Object Library (this 

注释:code will work with any verson of Access that 

注释:supports Automation) 

Dim MSAccess As Access.Application 

Private sub Command1_Click() 

  Set MSAccess=NEW Access.Application 

  MSAccess.OpenCurrentDatabase(App.Path & "\novelty.mdb") 



  MSAccess.DoCmd.OpenReport "rptEmployess",acViewNormal 

  MSAccess.CloseCurrentDatabase 

  Set MSAccess=Nothing 

end Sub 

注:acViewNormal告知Access打开该报表并立即打印。 

   这种方法有个缺点,就是运行环境中必须装有MS Access。 
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -