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!

A new form reading the same record?

Status
Not open for further replies.

cobweb

IS-IT--Management
May 5, 2002
95
GB
hi there:
I have a form with a master record and a child table frame.
I want to look up some data from another child table - no relation to the first child. paradox9 does not let me do this (greying out the DM). And a new page is no good either.
So...... How about having another form as a dialog box that opens to reveal the other child frame - but for the same record.
I can have the second form open fine, but it starts from the beginning of the master table.
How can i make the second form read the same record as the first?

Thanks in hope!
 
Hmmm, I'm puzzled why you are having problems with the form. Unless I'm not understanding what you are trying to do. Paradox9 will let you have multiple child tables on a form with one master.

If you want to do a dialog box you can use setRange() to filter the form to the key value of the master table.

var
f form
endVar

f.open("dialog form")
f.setrange(keyvalue)
 
cobweb,

>> greying out the DM

Ah! I think I see what your problem is. Paradox only lets you have one copy of a table in the data model if you have a repeating object bound to that table, e.g. a table frame or multi-record object (MRO).

I have seen tricks where people will use two aliases to place a table in a data model twice, but your idea of using the second form is the better approach.

Kliot showed what's arguably the most idiomatic way to open a form and sychronize it to the selected record on a different form, but there are other approaches.

-- Call qLocate (or locate) to move to the select key value.

-- Call MoveToRecordNumber or MoveToRecord

-- Open a form using a query as the master table of the form. The query, of course, uses criteria to select the appropriate record(s).

And so on.

While none of these will run as quickly as the setRange approach, they are sometimes preferable for different reasons.

Hope this helps...

-- Lance
 
Hey Lance, who are you calling idiomatic, oh wait I thoutht you said something else....

Paradox doesn't let you have multiple table frames attached to the same table in a DM, but you can have the same table in the DM multiple times without having to use an alias and attach multiple frames to the same table that way. In cobewb's post he said he was using a second child table unrelated to the first so I didn't think this was the problem.

Qlocate()
and movetorecordnumber()

Will also move to the appropriate record but they won't restrict the user from moving off the desired range which may or may not be desired.

Perhaps he can post us some more info so we can figure this out.

Perrin
 
Thanks a lot guys; i am always amazed at the speed of response. I am not able to try anything you suggest (its late here in the UK!)but you wanted details.
The master table is like the apex of a triangle with two distinct child tables. It is actually a bit like an order header with an order detail table and a batch table as the two children . The form is based on the order header with the order details as the table frame. What i need to know is what batch the order is in as well. It is this second child table that paradox does not like.The order can be in several batches (trust me on this!), so a single field does not suffice.
Does that help? i am in your expert hands!
 
I stil think it should work. The way I understand it your table structure follows something like:

Master
Orders
Invoice Number -> Keyed
Customer Number
Etc..

Child
Details
Invoice Number -> Keyed
Code Number -> Secondary Keye
Etc.

Batch
Batch Number -> Keyed
Invoice Number -> Secondary Key
Etc..

The Orders table is linked to the Details with the Invoice Number. The Orders table is linked to the Batch table with the Invoice Number using a secondary index in the Batch table. I have forms that are set up exactly like this and they work just fine.

Let me know if I'm not understanding your table structure.

Perrin
 
Thank you very much, both of you.

The setRange() works a treat!
 
Perrin,

>> Paradox doesn't let you have multiple table frames
>> attached to the same table in a DM, but you can have
>> the same table in the DM multiple times without having
>> to use an alias and attach multiple frames to the same
>> table that way.

True enough and it indicates this by greying out the table's icon in the data model. But it does so only after the table is bound to a repeating object (TF or MRO).

Be careful with adding tables to a DM multiple times. Certain versions of Paradox (and BDE) had problems unless you were very careful to specify unique table aliases (monikers, not database aliases) for the table in the DM.

While it is certainly possible to add multiple instances of a table in a DM, i'd be very cautious about doing so. To me, the need to to this suggests that there may be an easier way to accomplish the final goal.

Typically, Paradox is designed to work certain ways. When you find yourself working to hard to accomplish a task, it's likely that you're trying to force Paradox to do it one way when there's an easier approach you haven;t thought of. My rule of thumb for this is something along the lines of "if you think you're working too hard with Paradox, you probably are."

>> Qlocate() and movetorecordnumber() will also move to
>> the appropriate record but they won't restrict the user
>> from moving off the desired range which may or may not
>> be desired.

Exactly my point. SetRange is desireable for restricting movement, but if you need something else, then qLocate may be the appropriate trick. It's a bit like learning when to use a drill instead of a hammer. :)

Hope this helps...

-- Lance
 
Lance,

Once again I am humbled by your knowledge of paradox and articulate way of explaining things. I'm more of a successful hack than an expert and I have been known to get myself into trouble by pushing the envelope of what I should be doing.

P.S. Sometimes you've got to whip out the hammer drill to get the really tough jobs done :)

Perrin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top