Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching using SQL
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Searching using SQL
Miscellaneous
Thread ID:
00812676
Message ID:
00812676
Views:
46
Good Morning,

I have a form with 5 Text Boxes and 5 Combos. What I am trying to do is to search a table by any combination of those 5 fields. In each of the combo's I have 2 values which are = and $ which means we can produce different types of searches.

If I was searching with the first field then my syntax would be something like:
Local lcdesign

DO CASE
	CASE thisform.combo1.displayvalue='='
           lcdesign="modacad.key3=thisform.text1.value"
        CASE thisform.combo1.displayvalue='$'
           lcdesign="modacad.key3$thisform.text1.value"              	     
ENDCASE

WITH main.lstSource
 .RowSourcetype = 3
 .Rowsource = 'SELECT mainkey FROM ("U:\Data\modacad.dbf")'+;
              'WHERE &lcdesign order BY mainkey into cursor result'
 .ColumnCount = 1
ENDWITH
That is for the first field named Design Number. Now I want to include another field:
LOCAL lcdesign

DO CASE
	CASE thisform.combo1.displayvalue='='
           lcdesign="modacad.key3=thisform.text1.value"
        CASE thisform.combo1.displayvalue='$'
           lcdesign="modacad.key3$thisform.text1.value"              	
ENDCASE

IF NOT EMPTY( ThisForm.text2.value )
  lcDesign = lcDesign + ' AND modacad.key4 = ' + ThisForm.Text2.Value
ENDIF

SELECT * ;
FROM ("U:\Data\modacad.dbf") ;
WHERE &lcdesign ;
order BY mainkey ;
INTO CURSOR crssearch
I have another 3 fields now to add into my search. Basically what I am after is that I have 5 Text fields (Text1....Text5) each having a combo (Combo1....Combo5).

I would like to be able to search by any combination of fields? Am I going down the right lines?

Many Thanks
Neil Lewis
IT R&D Manager
Velmore Ltd
Next
Reply
Map
View

Click here to load this message in the networking platform