biểu mẫu (form) - ttdungit.files.wordpress.com filemacro có thể liên kết các đối...
TRANSCRIPT
![Page 2: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/2.jpg)
NỘI DUNG
MACRO LÀ GÌ?1
PHÂN LOẠI MACRO2
STANDALONE MACRO3
DATA MACRO4
CONNECTING MACROS TO FORM5
![Page 3: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/3.jpg)
MACRO LÀ GÌ?
Macro là tập hợp các lệnh được định sẵn
Macro có thể liên kết các đối tượng trong CSDL
Macro được dùng khiCó các hành động thường xuyên lặp lại (tự động hóa
công việc)
Kết hợp các hành động đơn giản
![Page 4: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/4.jpg)
PHÂN LOẠI MACRO
Standalone macro Là một đối tượng của CSDL
Sau khi được tạo và lưu thì nó xuất hiện trong Navigation pane
Data macro Được lưu trữ như một phần của Table
Có thể thiết lập để thực thi macro trước hoặc sau khi một bản ghi được thêm vào, chỉnh sửa hoặc xóa Thường dùng để thiết lập Validation rule hoặc default value
Embedded macro Được lưu trữ như một phần của form hoặc reportMacro chỉ được thực thi khi form hoặc report hoặc một đối
tượng trên form hoặc report chịu tác động của một sự kiện
![Page 8: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/8.jpg)
TẠO STANDALONE MACRO
2. Chọn Action trong khung Add New Action hoặc Action catalog
![Page 15: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/15.jpg)
MỘT SỐ THAO TÁC KHI THIẾT KẾMACRO
Copy actionGiữ phím Ctrl, kéo Action đến vị trí mong muốn
Thêm commentAdd new action chọn Comment
![Page 16: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/16.jpg)
SUBMARCOS
Subroutines: a set of actions (commands) with a name
Subroutines can be performed by calling it using its name
In Access, subroutines are called submacros
Submacros contain actions or other submacros
![Page 17: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/17.jpg)
CREATE A SUBMACRO
1. Display the Action catalog and the Program Flow (if they are not displayed)
2. Drag the Submacro to the macro or double click on the Submacro
3. Type a name for the submacro
4. Enter the submacro’s actions and arguments
![Page 21: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/21.jpg)
AUTORUN MACRO
To create a macro that automatically runs when the database opens: just name the macro AutoExec
If you do not want the AutoExec macro to run, hold down the Shift key while the database is loading
![Page 22: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/22.jpg)
ASSIGNING MACROS TO KEYS
Create a macro group named AutoKeys
AutoKeys contains submacros with the name of keys (or key combinations) on the keyboard
Access runs the appropriate submacro when you press the key
![Page 24: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/24.jpg)
NAME A KEY-ASSIGNMENTMACRO
^ indicate Ctrl key
+ indicate Shiftkey
Put {} around key names that are more than one letter long
![Page 44: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/44.jpg)
VÍ DỤ 3: SYNCHRONIZING DATA
Tự động tính toán lại số lượng hàng trong kho khi có khách hàng đặt hàng.
Các macro cần thiếtBảng liên quan: Products và Order Details
Macros:◦ After Insert: đặt hàng mới
◦ After update: chỉnh sửa đơn hàng cũ
◦ After delete: xóa đơn hàng
![Page 52: Biểu mẫu (form) - ttdungit.files.wordpress.com fileMacro có thể liên kết các đối tượng trong CSDL Macro đượ dùng khi Có các hành động thường xuyên lặp](https://reader030.vdocuments.mx/reader030/viewer/2022040117/5e043d98bafa0b02427a7e2f/html5/thumbnails/52.jpg)
EVENT
Control eventsXuất hiện khi thao tác với điều khiển
Ví dụ: On Click, On Change
Section eventsEvent xảy ra trên header hoặc footer của form
Ví dụ: On Mouse Move, On Click
Form eventsVí dụ: On Open, On Close, On Current, After Update