Home Database Mysql Tutorial 2012年计算机二级Access数据库基础知识笔记(8)

2012年计算机二级Access数据库基础知识笔记(8)

Jun 07, 2016 pm 03:02 PM
access Level 2 basic knowledge database computer

第八章 模块(18%22%,近年逐年增加,是重点考查内容) 考点一:模块的基本概念 1、 类模块:窗体和报表都属于类模块,而且它们各自与某一窗体或报表相关联(类模块可以作为独立的模块存在); 2、 标准模块:一般用于存放其他Access 数据库 对象使用的公共

第八章 模块(18%—22%,近年逐年增加,是重点考查内容)

  考点一:模块的基本概念

  1、 类模块:窗体和报表都属于类模块,而且它们各自与某一窗体或报表相关联(类模块可以作为独立的模块存在);

  2、 标准模块:一般用于存放其他Access数据库对象使用的公共过程;

  3、 将宏转化为模块:其实就是将宏实现的功能用模块(写VBA代码的方法)来表达出来。

  考点二:创建模块

  1、 创建新模块:这里注意创建类模块和创建标准模块的不同;

  2、 在模块中加入过程:所有的VBA程序代码都必须存在于过程中;

  3、 在模块中执行宏:可以使用DoCmd对象的RunMacro方法,具体格式为:

  DoCmd.RunMacro 宏名称

  考点三:VBA程序设计基础

  1、 面向对象程序设计的基本概念

  〈1〉 对象:是将数据和代码封装起来的实体;

  〈2〉 属性和方法:描述了对象的行为和性质,引用方式为:对象.属性或对象.方法;

  〈3〉 事件和事件过程:

  事件是access对象控件可以识别的“动作”,如单击命令按钮,向文本框中输入内容等;

  事件过程就是为某个事件编写VBA代码过程,完成指定动作;

  两者的区别就:事件是系统确定好的,事件过程可以由用户来编写。

  2、 VBA编程基础——常量、变量、运算符和表达式

  〈1〉 VBA的数据类型:

  Integer 整型、String 字符型、Single 单精度型、Double 双精度型、Boolean 布尔型、Date 日期型,Variant 变体型

  注解1:当转化其他的数值类型为Boolean类型时,0会转成False,而其他的值则转成了True;而将Boolean类型转成其他类型时,False成为0,而True成为-1.

  注解2:变量没有显示声明(用如Dim、Private、Static等语句),那么默认为变体类型。是一种特殊的数据类型,除了定义长String数据以及用户定义类型外,可以包含任何种类的数据。

  〈2〉 变量

  --声明变量的两种方法:隐性声明(默认为variant类型)和显性声明;

  注解:如果是 Dim x,y,z As Integer ,那么x,y为Variant类型。

  --变量的三个范围级别

  过程级别

  只有在声明此变量的过程中才可以使用的变量成为局部变量。可以使用Dim 或Static关键字来定义。

  注解:Dim定义的变量只有在其所在的过程运行时有值,static定义的变量在整个程序运行期间都有值。

  私有模块级别

  私有模块定义的变量只对所属模块过程可用,可以使用Dim和Private定义。

  公共模块级别

  一般用public来定义,所有的模块都可以用。

  〈3〉 数组

  --可以同时定义多个变量,有一维数组,二维数组…;

  --默认情况下数组下标为0,除非用Option Base 1来把默认值更改为1;

  --如定义一个一维数组 Dim s(3) as integer ,它等同于: Dim s(0 to 3) as integer ,两者都定义数组中有4个元素,分别是:s(0),s(1),s(2),s(3);

  --对于一个二维元素,根据同样的道理,如m(1,2),那么就这个元素中就包含2*3=6个元素。

  〈4〉 运算符

  --数学运算符〈重点掌握整数除法和求模运算符,见P96〉

  --比较运算符〈注意比较运算符的结果为逻辑值,true,false〉

  --连接运算符〈&(强制将两个表达式作为字符串连接) 和+(连接字符串数据)〉

  --逻辑运算符〈结果同样为逻辑值〉

  --表达式与优先级

  举例:求表达式12*3/4-7 mod2+2>3的值

  因为:算数运算符>连接运算符>关系运算符>逻辑运算符,算数运算符中乘除符号>求模>加减符号(具体见P98 表8.7)

  9-1+2>3,进一步推得10>3,所以结果为true。

  〈5〉 标准函数

  --这些函数都是系统已经定义好的内置函数,使用就可以完成特定的功能,这一部分需要熟记,并知道每个函数的用法。

  具体见P98.

  3、 VBA程序流程控制语句

  〈1〉 语句的三个分类:

  声明语句:命名和定义过程、变量、数组以及常数;

  可执行语句:执行赋值、判断、循环等各种操作,运行函数或过程等;

  赋值语句:将变量或常量赋给一个值或表达式。

  〈2〉 注释语句

  --使用Rem语句,格式为: Rem 注释语句

  注解:如果Rem和代码语句在同一行,则前面应该加上冒号(:)

  --使用 ‘ ,格式为: ’ 注释语句

  〈3〉 条件语句:根据条件表达式的值来选择程序运行语句

  If….Then

  If…Then…Else

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
How to configure zend for apache How to configure zend for apache Apr 13, 2025 pm 12:57 PM

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

Using Dicr/Yii2-Google to integrate Google API in YII2 Using Dicr/Yii2-Google to integrate Google API in YII2 Apr 18, 2025 am 11:54 AM

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

What is apache server? What is apache server for? What is apache server? What is apache server for? Apr 13, 2025 am 11:57 AM

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.

How to solve nginx current limit How to solve nginx current limit Apr 14, 2025 pm 12:06 PM

The Nginx current limit problem can be solved by: use ngx_http_limit_req_module to limit the number of requests; use ngx_http_limit_conn_module to limit the number of connections; use third-party modules (ngx_http_limit_connections_module, ngx_http_limit_rate_module, ngx_http_access_module) to implement more current limit policies; use cloud services (Cloudflare, Google Cloud Rate Limiting, AWS WAF) to DD

Real-World MySQL: Examples and Use Cases Real-World MySQL: Examples and Use Cases Apr 14, 2025 am 12:15 AM

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.

See all articles