Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CTRL+F within a grid?
Message
From
14/06/2000 09:07:05
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00380149
Message ID:
00380159
Views:
16
>My favorite thing in foxpro 2.6 was the ability to open a browse window the do a CTRL+F and find something in any viewable field in the browse
>
>My question is, is there any way to have a grid on a form then do a CTRL+F and find a value in any viewable field in the grid

Hi Stephen,
I have learned this code from Marcia Akins.

LPARAMETERS tcAlias, tuSearchVal, tlMatchWholeField
LOCAL laFields[1], lnFieldCnt, lnField, llMatchFound, luCompVal
*** Make sure passed alias is available
IF ! USED( tcAlias )
USE ( tcAlias ) IN 0
ENDIF
*** Get the field names
lnFieldCnt = AFIELDS( laFields, tcAlias )
SELECT ( tcAlias )
*** Scan the table
SCAN
*** look for a match in each field
FOR lnField = 1 TO lnFieldCnt
luCompVal = IIF( INLIST( VARTYPE( EVAL( lafields[ lnField, 1 ] ) ), 'C', 'M' ), ALLTRIM( EVAL ( laFields[ lnField, 1 ] ) ), EVAL ( laFields[ lnField, 1 ] ) )
llMatchFound = .F.
IF tlMatchWholeField
IF tuSearchVal == luCompVal
llMatchFound = .T.
EXIT
ENDIF
ELSE
IF INLIST( VARTYPE( EVAL( lafields[ lnField, 1 ] ) ), 'C', 'M' )
IF tuSearchVal $ luCompVal
llMatchFound = .T.
EXIT
ENDIF
ENDIF
ENDIF
ENDFOR
IF llMatchFound
EXIT
ENDIF
ENDSCAN
IF llMatchFound
MESSAGEBOX( 'Match found in field: '+laFields[ lnField, 1 ]+CHR(13)+ 'Record Number '+ALLTRIM( STR( RECNO( tcAlias) ) ) )
ENDIF

Cemal.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform