Separate speaker notes to accompany ADOwithDLDCDG
The use of DataList, DataCombo and DataGrid are covered in this presentation.
This program uses ADOs attached to three tables and DataCombo and DataList Controls. As you will see, I am repeating information on the slides as I show use.
Note that when the drive number (123, 124, 125 changes, the drive name changes. Also note then when the donor id number changes the donor id name changes in both the DataCombo control and the DataList control.
In this DataCombo field we want to print the donor name that goes with the donor idno. The donor idno is on the donation table which is the table we are processing. The donor idno is also on the donor file and so we want to link into the donor file and get the name that goes with the idno currently active in the donations table. The DataSource and DataField provide the name of the table that we are processing and the field that we want to use to link into the Donor table.
The RowSouce points to a the table that we want to reach into to pull out the name. The ListField tell which field we want to pull out and the BoundColum establsihes which field to link to when establishing the relationship between the two tables.
This slide shows the DataCombo field where I want to display drive name. Drive name is on the drive table and I will link into it from the active donation table that I am processing.
On this slide I am using the DataList to show the name.
This is the code that handles the same processing shown on previous slides. The name is PrDonationy.vbp with frmDonationy.frm.
This sets up three ADOs and the links to the fields.
Select Microsoft ADO DataControl 6.0 and MicrosoftDataGridControl 6.0.
This shows the code to connect the ADO to the data. By having the connection hard coded, you avoid the problem of moving the data from one machine to another.
All assignments you pass in should include this code.
The dataGrid is linked to the Donor table through ADOSource.
You should do this if the development was done through custom. If you wrote your own code, you need to use the code on the following slide to connect the grid.
Data source requires an object reference so you must use the set - you are making a reference.
Right click and bring up the shortcut menu associated with the DataGrid. If you developed using custom, you can now click retrieve fields and see the columns here for editing. Note this version has no code written by me - all development was done through custom. Note after clicking on retrieve records, answer Yes to the message. The resulting column headers are shown. Note that if you did not use custom, these column headers still appear you just do not have this processing available.
If you right click and select edit you can edit the columns. In this case I selected the DStAdr column - there is a right arrow pointing down that did not appear on the slide. I am going to delete this column by right clicking and selecting delete. I also deleted the zip column. You can also point at the column dividers and drag to resize. (Make sure you are in right click edit mode)!
You can also right click and select properties to get these properties pages. Here, I right clicked Allow Update. I then went to the columns tab and changed the headers.
If you hard code everything, you can make columns invisible, change the caption, change the width as shown in this slide.
The results are on the next slide.
This shows the layout achieved by the code on the previous slide.
Be sure that you set the EOFAction to 1 adStayEOF or the EOF will not work.
Note that I wrapped the text on Private Sub to fit on the slide.
This code will display which record is being processed on the ADO caption.
Note this is executed when the ADODonor move is complete.
This shows the output from the previous slide and the record count information as the caption to the ADO.