Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Flexible search/find form?
Message
From
04/01/1999 09:33:54
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00172137
Message ID:
00172384
Views:
19
>Does anybody have a form that does SEEKs on multiple fields at once? I want to be able to lookup a record in a database based upon criteria from multiple input fields. But sometimes the fields that get used for the SEEKs are left blank and would not be part of the search critieria in those cases.

I don't know if this will help but here goes.

Often I have something like that but I am doing a select. What I'll do is set up a string. First I'll put the first part of the select statement in a string:

the_sql = "select from table where encumb_id > 0" && some always true condition

Having the always true condition in there just saves me from having to figure out later where I need to put a where.

Then what I'll do is an if statement based on whether the user filled in teh field or not. For example:

if thisform.txtItemNumber = " "
item_part = " "
else
item_part = "and item_num = " + chr(34) + alltrim(thisform.txtItemNumber) + chr(34)
endif

Then I'll put the strings together:

the_sql = the_sql + item_part

Then I'll use macro substitution to cause the string to run itself:

&the_sql

so it runs the statement I've built.

Hope that helps. If it's clear as mud, please let me know so maybe I can explain it a bit better.
~~~~~~~~~~
Denise
~~~~~~~~~~
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform