Listbox SQL problem

Joined
Dec 13, 2009
Messages
5
Reaction score
0
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?
 
Joined
Dec 13, 2009
Messages
5
Reaction score
0
Correction: =[Forms]![Customer Form]![ID];
(Theres no typos in the real database)
 
Joined
Dec 13, 2009
Messages
5
Reaction score
0
This did it:

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

Case closed! :dance:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top