Thanks to all those who helped. I used a combination of info. Att'd is .txt summary
of responses.
This solution works for my situation:
Dim strTabName as String,
fltPID as Float
strTabName = SelectionInfo(SEL_INFO_SELNAME)
Select * From strTabName 'selection by user click
Into strTabName
Fetch First From strTabName
fltPID = selection.pr_parc_ID
Select *
From corner_infl ' base table
Where pr_parc_ID = fltPID
Browse * From Selection
'This is the row(s) I need
>From Henry A. Mumm and Carol Agius:
Try adding a
Fetch first from Selection
then,
varPID = selection.PID
------------------------------------------
from Yas NaKayama:
Dim alTemp As Alias
Dim nPID As Integer
Dim szUpdateStr As String
alTemp = Selection.PID
nPID = alTemp
szUpdateStr = "Select * from " + Parcel_table + " where PID = " + nPID +
" into Temp1"
Run Command szUpdateStr
Browse * from Temp1
Should give you a result with selection
------------------------------------------
from Richard Greenwood:
Try using varPID = selection.col1
I'm not sure why it makes a difference, but I have a MB program doing
almost exactly what you are doing and the only difference I see is that I'm
using .col1 rather than .PID
------------------------------------------
from Pete, Ordnance Survey, UK.
Firstly, after the user has made the selection using standard tools it might
be good idea to check that the selection was made from the correct table and
how many parcels were picked, something like:
if SelectionInfo(SEL_INFO_TABLENAME)<>"My_Table" then
note "ERROR! You must select the required parcels from ...Try again..."
exit sub
else
end if
'*** then place the selection name into a variable gQSR_Sel_name ( a string):
gQSR_Sel_name = SelectionInfo(SEL_INFO_SELNAME)
'*** Maximum of 1 (?) Parcels can be selected ***
if SelectionInfo(SEL_INFO_nrows)>1 then
Note "A maximum of 1 parcels can be selected. You have selected
"+SelectionInfo(SEL_INFO_nrows)+". Please try again"
exit sub
end if
'*** If all is well, use the fetch statement to get the PID information you
require thus:
Fetch first from gQSR_Sel_name
varPID = selection.PID
Do while not EOT(gQSR_Sel_name)
'*** Do your SQL stuff here...
Fetch next from gQSR_Sel_name
varPID = selection.PID
i=i+1
loop
'*** can use above to work with more than one parcel at a time - good luck
with the SQL syntax though!
This code is cut from one of my applications and works ok, - but may need
adapting to your app now I have hacked it about!
------------------------------------------