Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i two table frames on a form in sync

Status
Not open for further replies.

SpaghettiStraps

Programmer
Apr 19, 2002
14
US
mike presswood's book has a little section on how to keep to forms in sync but i don't know how to translate this into table frames.

i have two tables:

"constituents"
ImportID A20*
LastName A30
FirstName A15
Solicitor# A3

"projected income"
ImportID A20*
Expected Amt $
Reforecast Amount $
Actual Received $

what i want is the equivalent of a "live query" where a person can update the "projected income" table directly. the problem is -- without the last name, first name, and solicitor# fields from "constituents" the projected income table is useless. and it needs to be in table format (i.e. looking like a spreadsheet). i tried the data model route and when i link the two tables i can get all the fields in the table frame BUT the fields from "constituents" can't be filtered or sorted -- which is also necessary.

am i making any sense? so i thought if in the data model, rather than linking the two tables, i'd have them unlinked and "sync" them on the form. but that's where i'm stumped.

your help would be appreciated. thanks.
 
SpagettiStraps,

The best way to do this is, as you originally suspected, to link Constituents to Projected Income (PI) in the Data Model dialog. Paradox will then automatically locate the single matching PI record as you scroll through the Constituent data.

You can do this in code, if you prefer, by adding something along these lines to the action event of the Constituents table frame:

Code:
method action(var eventInfo ActionEvent)
var
   tcSource,
   tcTarget  TCursor
endVar

   if eventInfo.actionClass() = dataAction then
      doDefault
      tcSource.attach( Constituents )
      tcTarget.attach( Projected_Income )
      if tcTarget.&quot;ImportID&quot; <>
         tcSOurce.&quot;ImportID&quot; then
         tcTarget.Locate( &quot;ImportID&quot;,
                          tcSource.&quot;ImportID&quot; )
         Projected_Income.resync( tcTarget )
      endIf

      if tcSource.isAssigned() then
         tcSOurce.close()
      endIf

      if tcTarget.isAssigned() then
         tcTarget.close()
      endIf
   endIf

Mind you, this assumes your table frames and field objects have the default names; you may need to adapt them to fit your actual form.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top