Thứ Sáu, 27 tháng 6, 2014

Lưu ý 2 Macro: Autoexec và Autokeys





Create an AutoExec macro
If the database is opened for the first time to perform the specified operation, you can use a special macro named AutoExec. This macro can be one or a series of operations performed in the first time you open the database. When you open a database, Microsoft Access looks for a macro named AutoExec, and if found, it is automatically run it. Create an AutoExec macro as follows:

1) to create a macro that contains the operation you want to run when opening a database.

2) AutoExec macro name to save the macro.

3) the next time you open the database, access will automatically run the macro.

4) If you do not want to run the AutoExec macro when you open the database, open the database, press and hold the Shift key.

Operational implementation in the column:

Create an AutoExec macro, a welcome message box appears when you open the personnel management system database, and then run the personnel management system.

Procedure:

1) In the Database window, click the [object] in the list of objects (macro), and then click the [New] button on the Database window toolbar, as shown in
Picture this topic,

2) Select MsgBox action list in the message text box, enter "Welcome to the personnel management system".

3) in the list of actions to choose the OpenForm Form Name to select Personnel Management main form. Figure 2
Picture this topic,

4) AutoExec macro name to save the macro, the next time you open the database, the access will first run the macro, a message box pops up, as shown in Figure 3
Picture this topic,

5) press the OK after the message box into the "main form of personnel management.

II. Create AutoKeys macro group
To an operation or set of operations assigned to a specific key, you can create a the AutoKeys macro groups, press a specific key or key combination, Microsoft Access will perform the appropriate actions. Create AutoKeys macro group as follows:

AutoExec similar, except that the name of AutoKeys save the macro group. The following is a AutoKeys macro group is used to set the assignment of key combinations.

Key combination Description


^ A ^ 4 Ctrl + any letter or number key
{F1} function keys
^ {F1} CTRL + any function key
+ {F1} Shift + any function key
{Insert} Ins
^ {Insert} Ctrl + ins
+ {Insert} Shift + Ins
{Delete} or {DEL} Del
^ {Delete} or ^ {DEL} Ctrl + Del
+ {Delete} or + {DEL} Shift + Del

Walkthrough:

Establish a AutoKeys macro group, press Ctrl + O key combination, do open the staff table operation; press F6 to perform the query to all the information operations.

Procedure:
1) In the Database window, click the [object] in the list of objects (macro), and then click the [New] button on the Database window toolbar, as shown in

2) Click the button on the toolbar (macro name), in the "Macro name" column, type ^ O combination of keys. In the Action list, select the OpenTable political surface parameters "table name" the staff table.

3) the next line of the macro name ", type" {F6} "in the Operation Example table select OPENQUERY in the Query Name text box, select all the information of the personnel, the result of the operation shown in Figure 4 below.

4) The the AutoKeys name save the macro group, as long as the personnel management system database is open, press Ctrl + O key combination, the implementation of open the staff table operation, press F6 to perform the query to all the information operations in any case.

Tham khảo từhttp://www.databaseskill.com/3836164/

Lưu ý: Form: Tạo công thức tính trên textbox trong Form và truyền tham số


=[MUONSACH Subform].Form!Sosach

Thứ Tư, 25 tháng 6, 2014

Lưu ý FORM: (Mainform - Subform) - Link Child Fields và Link Master Fields




Liên kết biểu mẫu chính và biểu mẫu phụ
Trong chế độ Design View của biểu mẫu chính, mở bảng thuộc tính của điều khiển biểu mẫu phụ.
Lập thuộc tính LinkChildFields thành tên trường nối kết trong biểu mẫu phụ, nếu có nhiều trường nối kết, phân cách nhau bởi dấu phẩy.
Lập thuộc tính LinkMasterFields thành tên trường nối kết hoặc tên điều khiển trong biểu mẫu chính, nếu có nhiều trường nối kết, phân cách nhau bởi dấu phẩy.