>>Is there a way to be able to select fields from a database and search the database for text/numbers from the selected fields ?
>>
>>I have seen such a beast from a competitior's software. When the appropriate button is pressed, a form pops up with a list of the fields within the database with tick boxes next to them, and these fields are then searched, rather than all of the fields in the database.
>>
>>Obviously, one could put certain selected fields into a form, and finddialogue would search them all, but one of my customers has a parts system which involves a part number, a general number, and a component number, as well as two descriptions, one in French, the other in English. The part numbers are their own part numbers, the component number is their suppliers part number, and the general number is a form of category. They may only wish to search on one or two of these fields, or perhaps all of them. Equally, their are 2 description fields, and they may only want to search for a certain type of component such as 'nuts and bolts',' integrated circuits' etc.
>>
>>Basically, I need to be able to let them put ticks in boxes and to be able to search only the selced field(s)
>>
>>Would appreciate any input
>>
>>Many thanks
>>
>>Michael Johnson
>>mkj575920@aol.com
>
>Check QBF sample in solution.app
>Cetin
Michael,
Probably I got your question wrong. Was it soemthing like this:
Public oForm
oForm = Createobject('myForm')
oForm.Show
Define Class myForm As Form
DataSession = 2
Top = 0
Left = 0
Height = 400
Width = 750
DoCreate = .T.
Caption = "Search Test"
Add Object grdcustomer As Grid With ;
Height = 200, Width = 730, RecordSource = "customer"
Add Object lststruc As ListBox With ;
RowSourceType = 8, RowSource = "customer", ;
Height = 170, Left = 12, MultiSelect = .T., Top = 204, Width = 144
Add Object txtsearch As TextBox With ;
Height = 23, Left = 168, Top = 240, Width = 192, Name = "txtSearch"
Add Object cmdSearch As CommandButton With ;
Top = 264, Left = 168, Height = 27, Width = 84, Caption = "Search"
Add Object cmdClearFilter As CommandButton With ;
Top = 264, Left = 264, Height = 27, Width = 84, Caption = "Clear filter"
Procedure Load
Use customer
Endproc
Procedure cmdSearch.Click
Local strSearch,ix
strSearch=''
With Thisform.lststruc
For ix=1 To .ListCount
If .Selected(m.ix)
strSearch = strSearch + ;
Iif(Empty(strSearch),'',' or ')+;
'"%%VALUE%%" $ Lower(Transform(' + .List(m.ix) +'))'
Endif
Endfor
Endwith
strSearch = Strtran(strSearch,'%%VALUE%%',Lower(Alltrim(Thisform.txtsearch.Value)))
Select customer
_Cliptext = strSearch
Set Filter To &strSearch
Thisform.Refresh
Endproc
Procedure cmdClearFilter.Click
Select customer
Set Filter To
Thisform.Refresh
Endproc
Enddefine
Cetin