Search on multiple fields

Search on multiple fields

Post by Dale Mulli » Sat, 31 Aug 1996 04:00:00



Hello all. I have a database that contains 16 different fields. I
would like users to be able to search for a match on more that one
field. I have tried this code like the following with no luck :
---------------------------------------
with Parking_table do
begin
  Open;
  SetKey;
  FieldByName('Ticket Number').AsInteger := 123;
  FieldByName('Last Name').AsString := Last_name_edit.Text;
  FieldByName('License Number').AsString := License_number_edit.Text;
  if GotoKey then
    MessageDlg('Record found.', mtInformation, [mbOK], 0)
  else
    MessageDlg('Record not found.', mtInformation, [mbOk], 0);
  Close;
end;
-----------------------
Anyone have any suggestions?

Thanks,
Dale

 
 
 

Search on multiple fields

Post by Bruce Car » Sat, 31 Aug 1996 04:00:00



Mullins) says:

Quote:

>Hello all. I have a database that contains 16 different fields. I
>would like users to be able to search for a match on more that one
>field. I have tried this code like the following with no luck :
>---------------------------------------
>with Parking_table do
>begin
>  Open;
>  SetKey;
>  FieldByName('Ticket Number').AsInteger := 123;
>  FieldByName('Last Name').AsString := Last_name_edit.Text;
>  FieldByName('License Number').AsString := License_number_edit.Text;
>  if GotoKey then
>    MessageDlg('Record found.', mtInformation, [mbOK], 0)
>  else
>    MessageDlg('Record not found.', mtInformation, [mbOk], 0);
>  Close;
>end;
>-----------------------
>Anyone have any suggestions?

>Thanks,
>Dale

You have several options at your disposal:

1. Create indexes on those fields you want to search, and change to the
index for the field you want to search, before you do the search.

2. Use a TQuery component and create dynamic SQL statements, note you can
use SQL to search fields without an index.

3. Iterate through each record to find the record/field with the value you
want.

Cheers.. Bruce Caron

 
 
 

Search on multiple fields

Post by Paul Curra » Sat, 31 Aug 1996 04:00:00


Try a filter component or a query



Quote:> Hello all. I have a database that contains 16 different fields. I
> would like users to be able to search for a match on more that one
> field. I have tried this code like the following with no luck :

 
 
 

1. SQL - search in multiple fields

Group,
my DAO to MDB app is now (thanks to this newsgroup) almost functional.
Only thing left is searching in multiple fields based on my searchstring
(input from textbox).
Underlying example works fine if the string exists in the FirstName field,
but I would like to make some AND or OR query so that the searchstring will
be looked up in the MiddleName and LastName fields as well.
Cant't figure it out so any help would be highly appreciated.....
            Xarbos

Set rs = db.OpenRecordset("SELECT ContactID," & "FirstName," & "MiddleName,"
& "LastName FROM MainTable WHERE FirstName LIKE '*" & SearchString & "*';",
dbOpenSnapshot)

2. Open Cursor Expands TempDB until it is Full

3. Search in multiple fields

4. MSACCESS: data aware components

5. Search on multiple fields with CDML?

6. Muliple DTS file upload

7. Searching on multiple fields

8. Search in multiple fields?

9. Searching on Multiple fields

10. Searching multiple fields with the Excalibur search engine??

11. web one entry for multiple field search??multiple

12. Multiple Field Searches