Results 1 to 4 of 4
  1. #1
    Sundway is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2012
    Posts
    3

    Lisbox SQL problem

    How do I make a listbox on a form to list all recommended customers?

    The form, named "Customer Form", is based on a simple table named "Customers" with
    the fields ID,Name,Recommended_by. The field "Recommended_by" has the datatype
    Long Integer and just stores another custromers ID number.

    On the Form is a listbox in which I want to display all customers (name only) that has been
    recommended by the customer that is presently beeing displayed in the
    form.

    I set the listbox's rowsource to:
    SELECT Customer.ID,
    Customer.Name, Customer.Recommended_by
    FROM Customers


    WHERE
    Customers.Recommended_by=[Forms]![Custumer Form]![ID];

    But this doesent work! The listbox get empty!

    If I put a textbox in the form and just write =[Forms]![Custumer Form]![ID]; it shows the ID so theres nothing wrong
    with anything else it seems. Also if I change the "[Forms]![Custumer Form]![ID]" to an ID number, lets say 1141, it shows all customers with ths ID numer in the field Recommended_by.

    Whats wrong?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Sundway is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2012
    Posts
    3
    Yes I posted on two diffrent forums. Something wrong with that??
    (The "Custumer Form" is just a typo)

  4. #4
    Sundway is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2012
    Posts
    3
    This did it:

    Private Sub Form_Current()
    Me.List_Customers.Requery
    End Sub



    Case closed!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2010, 03:25 PM
  2. query problem i have a problem wi
    By maxx3 in forum Queries
    Replies: 0
    Last Post: 06-29-2009, 02:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums