searching multi fields in table

steve1111

Registered User.
Local time
Today, 02:01
Joined
Jul 9, 2013
Messages
170
Hello,

i have a form with a control for "repair type" and a subform that has a query that searches a table holding vehicle repair records. on the form the user can enter up to 5 repair types, [repair1], [repair2], etc.. Then the control on the form holds each type of repair to search by. Since the user could use one or all five repair fields and put repair types likes brakes in field one on one record and field 5 on another record, how do i search to just pull out those records that have the specified search criteria?

If i put in [form]![control] in each of the 5 criteria in the query it comes back with no records, because it it looking for that type in every repair field rather than once between the five fields?

thanks for the help.
 
Don't put them all on the same criteria line in the query wizard, Put them on 5 different lines so that it creates an "OR" in the criteria when you look at SQL view, like:
WHERE (((Table3.Tropical)="yes")) OR (((Table3.Cirtrus)="yes"));

Goh
 
Thanks Goh, i entered the [forms]![MXTRepairLog]![cbxRepair] in each repair column of the query design view so it looks like the text is diagonally stepping down, but the vaules are only returning the records where the cbx from the form is in Repair1 and not pulling if they are in repairs 2-5?

SELECT tblMXT_Log.RecordID, tblMXT_Log.Division, tblMXT_Log.Van, tblMXT_Log.Odometer, tblMXT_Log.[Date Serviced], tblMXT_Log.[Repair 1], tblMXT_Log.[Repair 2], tblMXT_Log.[Repair 3], tblMXT_Log.[Repair 4], tblMXT_Log.[Repair 5]
FROM tblMXT_Log
WHERE (((tblMXT_Log.[Repair 1])=[forms]![MXTRepairLog]![cbxRepair])) OR (((tblMXT_Log.[Repair 2])=[forms]![MXTRepairLog]![cbxRepair])) OR (((tblMXT_Log.[Repair 3])=[forms]![MXTRepairLog]![cbxRepair])) OR (((tblMXT_Log.[Repair 4])=[forms]![MXTRepairLog]![cbxRepair])) OR (((tblMXT_Log.[Repair 5])=[forms]![MXTRepairLog]![cbxRepair]));
 

Users who are viewing this thread

Back
Top Bottom