<< Chapter < Page Chapter >> Page >

Sử dụng thiết kế data report

Thiết kế báo cáo dùng DataReport là điểm mới trong VB6, đây là một công cụ được hỗ trợ bởi VB6, cung cấp một cách trực quan về thiết kế báo cáo và có ưu diểm là rất dễ dùng.

Thiết kế với datareport

- Chọn Project ->Components.

- Chọn Tab Designers, đánh dấu chọn Data Report.

Hình 13.1 Đưa thiết kế báo cáo về đề án

Các thành phần của một báo cáo như sau:

- Report Header: Hiển thị một lần ở đầu báo cáo.

- Report Footer: Hiển thị một lần ở cuối báo cáo.

- Page Header: Hiển thị tại đầu mỗi trang.

- Page Footer: Hiển thị tại cuối mỗi trang.

- Detail Section: Hiển thị các dòng dữ liệu.

- Một hoặc nhiều nhóm đầu cuối hiển thị tại đầu và cuối mỗi phân nhóm.

Các điều khiển của thiết kế Data Report như sau:

- Điều khiển nhãn (Rpt Label).

- Điều khiển hộp văn bản (Rpt Textbox).

- Điều khiển ảnh (Rpt Image).

- Điều khiển hình dạng (Rpt Shape).

- Điều khiển các hàm tính toán (Report Function: rptFuncSum, rptFuncAve, rptFuncMin, rptFuncMax…).

Hình 13.2 Cửa sổ Data Report

Các điều khiển của Data Report cũng giống như là các điều khiển chuẩn trên biểu mẫu, chúng có thể ràng buộc với nguồn dữ liệu. Tuy nhiên, ta có một cách thức khác dễ dàng hơn đó là sử dụng môi trường dữ liệu (được giới thiệu ở chương trước).

Sử dụng DataEnvironment trong việc tạo DataReport:

Quá trình thực hiện trải qua các bước sau:

- Tạo đối tượng Command.

- Kéo thả các trường của đối tượng Command này vào thiết kế của Report.

- Thêm các tiêu đề đầu trang&cuối trang.

Ví dụ: Tạo báo cáo về các sinh viên trong bảng STUDENT thuộc cơ sở dữ liệu Student.

Hình 13.3 Thiết lập Data Environment- Bước 1: Tạo một nối kết đến CSDL Student trong trình Data Environment, thêm một đối tượng Command cho phép lấy dữ liệu từ bảng Student.

- Bước 2: Kéo thả các trường cần hiển thị vào báo cáo tại mục Detail, chỉ giữ lại trường liên quan đến thông tin dữ liệu (đặt trong phần Detail Section). Thiết lập tên trường dưới dạng tiếng Việt tại phần Page Header.

- Bước 3: Cung cấp các thông tin cho phép DataReport nhận dữ liệu từ đâu bằng cách xác lập: DataSource: DataEnvironment1, DataMember: Student.

Hình 13.4: Report khi đã kéo thả các trường

Thiết kế báo biểu có phân nhóm dữ liệu

Hình 13.4: Nhóm dữ liệu- Chọn đối tượng Command của trình DataEnvironment cần nhóm cơ sở dữ liệu.

- Hiển thị trang thuộc tính, chọn Tab Grouping.

- Chọn tùy chọn Group Command Object.

- Đặt tên cho nhóm cũng như chọn các trường tham gia vào nhóm dữ liệu.

- Đặt lại giá trị cho thuộc tính Data Member chỉ đến nối kết mới đã nhóm dữ liệu.

- Chọn báo cáo thiết kế, ấn chuột phải, chọn Insert Group Header/Footer.

- Chọn tên trường nhóm dữ liệu đưa vào đoạn Group Header.

Khi đó báo cáo được thiết kế như sau:

Hình 13.5 Báo cáo có nhóm dữ liệu

Xem và xuất data report

Ta có thể xem thông tin và in báo cáo trên một cửa sổ riêng biệt sử dụng chế độ Print Preview bằng cách thi hành phương thức Show.

Khi đó báo cáo sẽ được hiển thị như sau:

Hình 13.6: Thi hành báo cáo trong VB

Khi đó người sử dụng có thể duyệt qua các trang nếu như báo cáo có nhiều trang, cũng như chọn một trang báo cáo nào đó để in.

Questions & Answers

what is phylogeny
Odigie Reply
evolutionary history and relationship of an organism or group of organisms
AI-Robot
ok
Deng
what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Giáo trình visual basic. OpenStax CNX. Jul 29, 2009 Download for free at http://cnx.org/content/col10777/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Giáo trình visual basic' conversation and receive update notifications?

Ask