Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Environment and Grouped Report

Similar presentations


Presentation on theme: "Data Environment and Grouped Report"— Presentation transcript:

1 Data Environment and Grouped Report
Please use speaker notes for additional information! This presentation deals with a data environment and a report with groups. There is also a form where you can move from group to group and from record to record within groups.

2 PrStudentRel.vbp This shows the form that is used. The Group buttons are used to navigate between groups and the Next Student button is to navigate between students within groups. The Report menu controls printing or displaying the report.

3 PrStudentRel.vbp This is the display of the first record on the form. Note that the records are grouped by Major Code and IT is the first major code.

4 PrStudentRel.vbp This shows the display of the Report. Note that the first record shown on the report is the first record shown on the form on the previous slide.

5 The first step in creating a data environment is to go to Project and select Add Data Environment. The Data Environment is created as shown.

6 Select 4.0 for Access200 and 3.51 for Access 97.
The DataEnvironment and the DEConnection have now been named. Right click on the DEConnectionand select Properties to make the connection. Select 4.0 for Access200 and 3.51 for Access 97. The next step is to right click on conStudentRel and then select Properites

7 Continuing with the connection, we establish the path to the database.
The properties shows the results of establishing the path with the Data Link Properties. Continuing with the connection, we establish the path to the database.

8 The connection to the desired table in the database is now made.
Note that I have clicked on the + beside Student00 to see the fields. If I click on the - that is currently there, the + will reappear and the fields will not be listed. The connection to the desired table in the database is now made.

9 Everything has now been named to match the actual project that I am recreating.
I now am adding a Data Report by going to Project/Add Data Report. Note that the report shows up under Designers.

10 Note that in the Student00 Command object properties, you select Grouping. You then click on Group Command Object and move the field that you want to use in the grouping. The results are shown.

11 Data has been dragged and dropped to the report and a header added.
Note that I am not using the Report Header or Footer so they are closed. The page header has the report name and the field names which have been revised. The fields show the data.

12 rsStudent00_Grouping is defined in the data environment
rsStudent00_Grouping is defined in the data environment. rsStudent is defined by me. It is the collection of records in a particular group. When I display the report, I first create bookmark so that I will know where I was when I left to run the report. Note that there is a bookmark for the group and a bookmark for the individual record. This means that I will return to the same place in the table when I return to the form. Note that the form is shown in vbModal. I need to do something that will relinquish the report object and in vbModal clicking on the form will no that. Another technique I tired was using a message box after the form to disassociate with the report. After the report, I use the stored bookmark to bring up the next record. Note that I am dealing with two record sets, the grouping recordset and the detail recordset. I need to reposition in both of them. More discussion of the detail recordset and the Fill_Textboxes on the next slides. Specifically, the next slide will deal with rsStudent

13 “You can create a Command hierarchy by grouping a Command object
“You can create a Command hierarchy by grouping a Command object. When a Command object is grouped, the grouped fields are added to a grouping Command object that becomes the parent of the original Command object. In the resulting recordsets, the grouping Command object contains a row for each unique set of values of the grouped fields.” Microsoft VB Help (Grouping Command Objects) rsStudent is defined as a Variant. On form load, I do the routine which sets rsStudent equal to the recordset composed of records with the current major. When I create grouping, I essentially set up student00_Grouping which can be referred to with the automatic addition of rs in front. Please be sure to read the information on grouping available in Help under the heading Grouping Command Objects. I then defined rsStudent and set it to hold the records in a group. I can then fill the textboxes on the form using the fields in that structure.

14 The code to print and display is similar. Note that to print you use
The code to print and display is similar. Note that to print you use .PrintReport and to display you simply use .Show. In both cases you are referring to the report (rptStudentRel in this example).

15 Navigating from group to group uses rsStudent00_Grouping.
Navigating the students within the group is what required the definition of rsStudent. You can now view all of the students in the group through this code. The original definition of group let me move from the first record in one group to the first record of the next group on the form. I wanted to be able to move through the records in each group. To do this, I defined rsStudent and set it equal to the recordset that contains the records in the group. Now I can move from record to record in the group filling the fields on the form using Fill_Textboxes.


Download ppt "Data Environment and Grouped Report"

Similar presentations


Ads by Google