Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching all fields in a database
Message
From
14/11/1996 19:12:21
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00012278
Message ID:
00012287
Views:
36
>>I,ve made a search form for my little program but I.m having a bit of trouble getting the search form to search all the fields in a database, I can only get it to search one field. Can somebody help me?
>>
>>Thanks!
>>Bill Clark
>
>Check out 'AFields()' in the Help file. See if this will get you started.
>
>HTH,
>Tom

Hmmm...With AFileds() you can of course get all the fields and do
a Locate For a value on each of them. But I would do it diffently:

m_SearchValue = ThisForm.EntryField1.Value
m_Order = ""
m_Found = .F.
FOR i = 1 TO 254
IF !EMPTY(TAG(i))
m_Order = TAG(i)
SET ORDER TO TAG &m_Order
IF SEEK(m_SearchValue)
m_Found = .T.
EXIT
ENDIF
ELSE
EXIT
ENDIF
NEXT i

Just make sure you create a CDX with tags for all possible searchable
fields, otherwise your FOR loop will execute only once with no success.
Some things are better be left unknown...NOT!!!
Previous
Reply
Map
View

Click here to load this message in the networking platform