Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How should I SCAN this?
Message
From
22/09/2000 12:08:48
Liam O'Hagan
O'Hagan Programming Ltd
Ireland
 
 
To
22/09/2000 11:24:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00419709
Message ID:
00419802
Views:
26
OK, lets try this.
Select Table1
Scan All
  llFound = .F.
  lnLen = Len(ID_Field)

  Do While !llFound and lnLen > 0
    llFound = Seek(Substr(ID_Field,1,lnLen), "Table2", "ID_Index")
    If !llFound Then
        lnLen = lnLen - 1
    Endif
  EndDo

  If llFound Then
    * Found a match - do some stuff here
  Else
    * no match - do some other stuff
  Endif
EndScan
This will scan table1 and look for a match in table2 for the full 6 digit ID. If it is not found it will remove the leftmost character until a match is found or until there are no more characters to remove.

It is up to you to decide how many characters are allowed to be removed by adjusting the length of lnLen at the top of the while loop.

HTH

Liam

PS This code is completely untested but you get the idea?
Liam O'Hagan
MCP VFP Desktop Apps
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform