View Full Version : Query problem with two tables


Gavin
05-01-2002, 04:27 PM
I have three tables. Customers, Contractors and trades which is a list of all possible building trades. The problem is this. When a customer needs a particulal trade ie plumber that trade is selected on the customer form using a drop down list box (trades tbl )they also enter their post code (UK format.. PO1 8HY ). I need to use these two values to cross reference with the Contractors table so that I can get a list of all possible tradesmen who are plumbers and at or near the same post code area.ie the PO1 part of the code.The first part of these post codes can be 3 or 4 digits long. Is it a simple problem or is it me. Any ideas please..Thanks

Jack Cowley
05-01-2002, 05:02 PM
Create a query based on the Contractors. Create a form with two unbound fields, PostCode and Trade. In the queries criteria section of the Contractors PostCode field use code like this: Like [Forms]![FormName]![PostCode] & "*". On the SAME criteria line in the Trade field put [Forms]![FormName]![Trade]. Add a button to the form to open the query. When you type in PO1 and Plumber in the form and click the open query button you should see all Contractors with PO1 as their PostCode and Plumber as their trade. If you want to include PO1 and PO2 that will complicate matters but you can do that too....

[This message has been edited by Jack Cowley (edited 05-01-2002).]

Gavin
05-01-2002, 10:01 PM
Many thanks. I will try your suggestion tonight.

Gavin
05-01-2002, 11:13 PM
Thanks Jack. The basic query works a treat. As all input into my forms is automatically converted into Initial caps is it just a matter of formatting the property boxes to produce this conversion when data is entered into the query ?.
PS. Where can you learn all about this code because I can now see where your comming from and I want to learn more.