View Full Version : query on two columns


Gazza2
11-27-2009, 01:46 PM
I hope this is in the right place.

I have a form(frmCustomerSelect) with a listbox which gets its data from a query(QryCustomerSelect).

The query gets its data from a customer\supplier table, the table has two checkbox columns , one for customer and one for supplier.

When i enter an accountcode(pk) into a textbox on the form it lists all the matching customers and suppliers but i only want it to match the customers.

this is the sql data behind the query :
SELECT accountcode, Companyname, address1, Telephone
FROM TblCS
WHERE accountcode Like '**'
ORDER BY accountcode;

My question is can i add a second WHERE statement to this or do i have to create another query to select just customers and the use that query as the recordsource of QryCustomerSelect.

Thanks in advance for your help

Gareth

RainLover
11-27-2009, 02:15 PM
SELECT accountcode, Companyname, address1, Telephone
FROM TblCS
WHERE accountcode Like '*'
AND checkbox = True
ORDER BY accountcode;

Gazza2
11-29-2009, 01:18 PM
Excellent rainlover works a treat

Thanks
Gareth

RainLover
11-29-2009, 11:21 PM
Thanks for the update.