Unit 13: Master/Detail Forms - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Unit 13: Master/Detail Forms

Description:

Approach 1: BCB creates master/detail forms ... In the Detail (i.e., child) table, update. MasterSource (point to ... the DBNavigator OnClick event: dmDemo ... – PowerPoint PPT presentation

Number of Views:169
Avg rating:3.0/5.0
Slides: 13
Provided by: conest
Category:
Tags: detail | forms | master | onclick | unit

less

Transcript and Presenter's Notes

Title: Unit 13: Master/Detail Forms


1
Unit 13 Master/Detail Forms
  • Demo View Customer Orders
  • Approach 1 Using TADOTable
  • Approach 2 Using TADOQuery
  • Queries with Parameters
  • Announcement Assignment 7

2
Demo View Customer Orders
  • Approach 1 BCB creates master/detail forms
    without coding!
  • bcdemos.mdb found in C\Program Files\Common
    Files\Borland Shared\Data

3
Approach 1 Using TADOTable Linking
Master/Detail Tables
  • In the Detail (i.e., child) table, update
  • MasterSource (point to Master/Parent)
  • MasterField (point to the link column)

4
Approach 1 Field Link Designer
  • Click ellipsis button of the MasterField property

5
Approach 2 Using TADOQuery
  • Set SQL strings
  • select from Customer
  • select from Orders
  • select from Items

6
Queries with Parameters
  • To define parameters
  • Parameters Editor
  • To update the query
  • Close the query
  • Set the parameter field
  • Re-open the query

7
Approach 2 Using TADOQuery Step 1 Adding
Parameter
  • In the Detail table (e.g., qryOrder)
  • Parameters property
  • Add new parameter / link field (e.g., CustNo)
  • Update SQL propertys WHERE clause
  • select from orders
  • where CustNo CustNo
  • Note When using TADOQuery, do not set DataSource
    property!

8
Approach 2 Using TADOQuery Step 2 Code
Parameter Field
  • Make parent query fields (e.g., qryCustomer)
    persistent
  • In Fields Editor Add All Fields
  • In the DBNavigator OnClick event
  • dmDemo-gtqryOrder-gtClose()
  • dmDemo-gtqryOrder-gtParameters-gt ParamByName("CustNo
    ")-gtValue dmDemo-gt qryCustomerCustNo-gtValue
  • dmDemo-gtqryOrder-gtOpen()

9
Approach 2 Repeat the two steps for
qryOrderDetail
  • Step 1 In qryOrderDetail
  • Parameters property
  • Add new parameter OrderNo
  • Update SQL propertys WHERE clause
  • select from items
  • where OrderNo OrderNo

10
Approach 2 Continue Step 2 for qryOrderDetail
  • Step 2
  • Make parent query fields (i.e., qryOrder)
    persistent
  • In the DBNavigator OnClick event
  • dmDemo-gtqryOrderDetail-gtClose()
  • dmDemo-gtqryOrderDetail-gtParameters-gtParamByName("O
    rderNo")-gtValue dmDemo-gtqryOrderOrderNo-gtValue
  • dmDemo-gtqryOrderDetail-gtOpen()

11
Your Turn
  • Create your own View Customer Order
    master/detail form using TADOQuery (Approach 2)

12
Assignment 7
  • Assignment 7 available today
  • Due in 2 weeks see Assignments page
  • You cannot use Approach 1 (using TADOTable) use
    Approach 2 instead.
  • Run sample program found in K\Scratch\CPAProgram(
    Co-Op)\Year 3\Programming with OOPS\Demo\Assign720
    02
  • Next Week
  • Adding Global Functions
  • Up Down Type Controls
Write a Comment
User Comments (0)
About PowerShow.com