General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Dan,
Thanks for the reply. I've been out a few days, so just now getting back to it.
1. Yes the rowsource type is SQL, but depends on which item (category) is selected. A parametized view would probably be best. Requery the view based on the category, then requery the combo.
2. There is no default supplier. The user must select a supplier. An add validates for empty supplier ID (control source of comboB) and an edit of the item # clears the supplier ID, forcing a new supplier choice. Yes I could put it in the lost focus of combo A, but I prefer to keep code that affects a control in the control if possible. It makes it easier to find.
3. You caught me! My app is actually a health services delivery app. The form is a service plan form (consumers get services [items] delivered by certain providers[suppliers]). Since it is a government program (Medicaid) it has a lot of weird rules. I find it easier to explain my questions with an invoice example. It's close enough and an example most everyone can relate to.
Thanks again for the help.
John
>John,
>
>First, if your rowsource is a SQL statement or view, all you have to do is call the requery() method of the combo. This will requery the source and re-populate the combobox.
>
>Second, you probably want to issue the requery in the lostfocus of comboA. What if comboB never gets focus and they think they want the default supplier currently showing in ComboB-- which may not be a valid ?
>
>Last, are you sure you want to select valid suppliers based upon a category? Sounds like you'll have a mess as suppliers change their inventory. Why not just set the rowsource of comboB to something like this:
>
>SELECT cSupplier ;
>FROM Suppliers ;
>JOIN supplierparts;
>ON suppliers.PrimaryKey=supplierparts.foreignkey;
>WHERE supplierparts.partid=comboA.value;
>into cursor B
>
>But then again, I don't know anything about your app.
>
>>Dan,
>>
>>Combo box A (rowsource = select item #, supplier_category from item into cursor A)
>>
>>Combo box B (rowsource = select supplier name from suppllier where category = A.supplier_category [or some form of THISFORM.cboItem.Listitem...])
>>
>>I set the rowsource in the Gotfocus event of combo box B. I could use a parametized view as the rowsource and requery there. I didn't know which would be the best way to do it. Thanks for the help.
>>
>>John
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only