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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching on multiple tables

Status
Not open for further replies.

CleoMan

Programmer
Jun 18, 2003
110
ZA
I currently use a table component on one of my forms.
This table component contains columns of 5 other related tables.

Now I want to perform a searh on the table component from one of the 5 other tables and then move to that record on the form.

The problem though is that I can only do a search and move to that record if the column is located in the 1st of the 5 tables.

This is a real bad description of the problem but bear with me! Any ideas or comments will be greatly appreciated
 
Here is my wild-assed guess based on what I think you said.

Assuming that the tables are joined in proper fashion, you can use a tCursor to open the underlying table you want to do the search on (let's say it's table #3), use locate() to find the record you want, then check the values of the table's composite key back to the parent table. THEN, you would need to search and refresh the tableframes normally, but in direct order from parent to child to child.

I.E. Let's say you want to find Austin Texas

(Table#1)

CountryID*
---------
US
UK
BR
DE

(Table#2)

CountryID* State*
--------- -----
US CA
US TX
US FL
US ME


Table#3

CountryID* State* City*
--------- ----- -----------
US TX Houston
US TX Austin
US TX Freeport

(caution - probable pseudocode)

tc.open("Table#3")
tc.locate("Austin","City")
qCountry = tc.CountryID ;vars
qState = tc.State
qCity = tc.City
tc.close()

This gives you the 3 variables needed to either set filters or search each table in progression. Then you would simply attach to each tableframe and use a tCursor to locate and refresh, starting with the parent and work your way to the last child.

I think I got this right ;) but it's early yet. Lance may have a better solution.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Well I would say your wild assed guess is right, I think it's a pretty good solution!

Thanks alot for the idea (and pseudocode), as I think this is the most logical answer/solution.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top