Thanks for your response Jacques,
Bellow is some code I slapped together to solve the problem, it checks all
open tables for the field "Record_ID" and if it finds the field performs a
search for "RecordID" which is a variable entered by the user.
It is quite messy with a lot of Goto statements and labels but it works, any
ideas on a cleaner version?
Dim RecordID As Integer
Dim i, j, jim, n As SmallInt
Dim TabName As String
If RecordID <> 0
i = 1
Goto Fst
Ba:
i = i + 1
If i = NumTables() Then
Goto Ha
End if
Fst:
For i = i to NumTables()
For j = 1 to TableInfo(i,TAB_INFO_NCOLS)
jim = "COL" + j
If ColumnInfo(i, jim, COL_INFO_NAME) = "Record_ID" Then Goto Ya
End If
Next
Next
Ya:
TabName = TableInfo(i, TAB_INFO_NAME)
Select * From TabName Where Record_ID = RecordID
Order By Record_ID
n = SelectionInfo(SEL_INFO_NROWS)
If n > 0 then Goto Ha
End if
Goto Ba
Ha:
End if
Thanks again for your response
Scott Barling
GIS/Assets Technical Assistant
Eurobodalla Shire Council
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
-----Original Message-----
From: Jacques Paris [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, 4 May 2000 21:48
To: Scott Barling
Subject: RE: MI Select a record from Multiple Tables
Scott,
With two tables, it is quite simple
select * from Swr_MH where Asset_ID = 09563
if selectioninfo(3) =0 then
'your record is in the other table
else
'it is already selected in Swr_MH
end if
One can think about many little things to add to that but I believe
that the
essence is there.
Good luck
Jacques Paris
e-mail alternate
[EMAIL PROTECTED] [EMAIL PROTECTED]
paris PC Consult (mainly MapInfo app.)
www.total.net/~rparis/gisproducts.htm
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Scott Barling
Sent: May 3, 2000 9:57 PM
To: MapInfo-L (E-mail)
Subject: MI Select a record from Multiple Tables
Hi All,
Just wondering if it is possible to select a record with a certain
value
from a set of tables if you don't know which table the record is in?
Let me explain with an example:
Tables Fields
Swr_MH Asset_ID
MH_No
Swr_Pipe Asset_ID
Pipe_No
If I have both tables open in MI and would like to select the record
with an
Asset_ID of 09563 but am unsure of which table it is in, is there a
piece of
code to achieve this sort of thing?
I want to build an mbx to perform a search on all open tables, for
the table
and record containing an Asset_ID entered by the user, and than to
select
that record.
Any help greatly appreciated and of course I will Sum.
Regards,
Scott Barling
GIS/Assets Technical Assistant
Eurobodalla Shire Council
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and
put
"unsubscribe MAPINFO-L" in the message body, or contact
[EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]