View Single Post
  #3  
Old May 19th, 2010, 01:38 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default help needed with a combo box

I would use an unchanging number for SupplierID. Names change.

Anyhow, in the After Update event of the supplier combo box, something like:

Dim strSQL as String

strSQL = "SELECT * FROM tblPriceList " & _
"WHERE [Supplier Name] = " " " & Me.SupplierName & " " " "

Me.sfrmItems.Form.cboProduct.RowSource = strSQL

This assumes a subform control (the "box" containing the subform) named
sfrmItems, and that the subform control's source object (form) has a combo
box named cboProduct.

I have used generic SQL, with an asterisk, but you probably want to use the
fields in your current Row Source query.

You probably want similar code in the form's Current event, after testing
whether a supplier has been selected, so that the combo box list shows a
filtered list of products when you revisit an existing record.


alanb wrote:
My main tables/fields are;
TblOrders
AB ref. Number , Order date, contract number, Supplier Name, job details, etc.

TblSuppliers
Supplier Name, address, tel, fax, email, contact name, etc.
TblPriceList
Supplier Name, Product Code, Item description, unit, Price, cost code, etc.
TblWorkItems
Work item ID, AB ref. Number, product code, item description, quantity, unit,
price, extended price.

My forms are as follows;
Frmorders
Tab one, Order Details, included button to print order (report)
Tab two, subfrmWorkItems (Linked with AB ref number), user to enter products
required.

Frm Suppliers
Tab one, Supplier Details
Tab two, subfrmPriceList (linked to supplierName)
Tab three, subfrmOrderHistory


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1