View Full Version : Combobox Question


ckhatch
05-03-2001, 07:24 PM
I have a combobox with the row source creating a select query I need the querys criteria to be set by what is in another field on this form (BillTo) I tried something like this
SELECT worksheet.[PO#], worksheet.OurPartNumber, worksheet.Description, worksheet.CustomerID FROM worksheet WHERE (((worksheet.CustomerID)=Me.[BillTo]));
But it didn't work

RedSkies
05-03-2001, 07:37 PM
Instead of Me.[BillTo], use forms![YourFormName]![BillTo]

ckhatch
05-04-2001, 05:27 AM
Alredy tried that it didnt work

KevinM
05-04-2001, 05:31 AM
Make sure the combo box is bound to [CustomerID]

HTH

ckhatch
05-04-2001, 05:53 AM
How do I do that
Would that not store the data of the customer Id in the combobox boumd field

[This message has been edited by ckhatch (edited 05-04-2001).]

KevinM
05-04-2001, 08:27 AM
I meant, CustomerID in the rowsource, not the ControlSource.

HTH

Abby N
05-04-2001, 08:36 AM
Greetings. This select statement in your Row Source should do it.

SELECT worksheet.[PO#], worksheet.OurPartNumber, worksheet.Description, worksheet.CustomerID
FROM worksheet
WHERE (((worksheet.CustomerID)=[Forms]![FormName]![BillTo]));

However, you also need to code the After Update event of the BillTo field with:

Me.ComboName.Requery

Depending on the way your form is set up you may also need to code the forms On Current event in the same way. Coding both will ensure that Access reruns the combos underlying query whenever the value of BillTo changes or you go to a new record. Hope this helps.

~Abby

ckhatch
05-04-2001, 02:45 PM
Alredy tried that and all I get is a blank line in my combobox
But I forgot to mention that the BillTo is also a combobox