Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012
    Posts
    2

    Question Unanswered: How do I create a query to find past customers?

    In my company we make custom made products for our customers from scans we store on our computer. When we get an order from a distributor for a customer we assign the the scan a number. We put the name of the customer, the name of the distributor, and the scan number in a database. We receive hundreds of new scans each month and a few reoders. Our records are divided by each year. How can I set up a query to find a previous orders by searching the customer name and have it show all the customer's information?

    For example. If I searched John Smith, the results would be:

    2001 John Smith Westside Distributing # 001 783
    2004 John Smith Westside Distributing # 040 997
    2004 John Smith Northberg Distributing # 040 567

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    select my, column, list from mytable
    where customername = 'blah'

    or
    select my, column, list from mytable
    where customerno = 12345

    you cold parameterise the query to take a value from a form control
    say you had an UNBOUND combo / list box containing customers called cbCustomers
    the where clause is something like

    strSQL = "select my, column, list from mytable"
    strSQL = strSQL & " where customerno = " & cbCustomers.value

    or
    strSQL = "select my, column, list from mytable"
    strSQL = strSQL & " where customername = '" & cbCustomers.value & "'"
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Just to clarify, when you say

    "Our records are divided by each year"

    you mean that each Record has a Field in which the year is stored, correct? You don't mean that you have a separate Table for each year, do you?

    Linq
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jan 2012
    Posts
    2
    Yes. Each year has it's own table in the database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •