Combobox...selected value not replicated to subform

jakobt

Active Member
Joined
May 31, 2010
Messages
337
I have a form:
I inserted a combobox with a customer Id and client name
I inserted a subform with orders.
The childfield is customerid.orders the master field is costurmerid.costumer.


When I select a customer in the combobox...the orders for the customer is not automatically updated in the subform?

(The form record source is set to customer)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi Jakobt
You may be changing the value of the customer ID for the record you're looking at rather than applying a filter.
To have a combo box act as a filter you need the combo box to not be bound to the data being presented and you need to attach a macro/action to apply a filter to the form after changing the combo box.
Please put in some additional detail to describe what you have done in more detail.
 
Upvote 0
The combobox is unbound: The query in the combobox is:

SELECT [customer].[customerid], [Customer].[Customer Name] FROM [Customer] order by customer.[customer name]

column count 2
column widths 0CM ; 2 CM

Would you know what code to enter in order to get the subform: 'orders' to filter on the customerid selected in the combobox.
 
Upvote 0
What are the recordsources of the form and the subform?
 
Upvote 0
Recordsource of combobox: Blank
FORM:
Recordsource of form: Customer

Subform:
Sourse object: orders
link master fields: customerid
link child fields: Customerid
 
Upvote 0
Design of Customer, Order Table? What fields are in these tables?
Do you have some AfterUpdate event code for the combo?
More info needed.
 
Upvote 0
No I dont have an afterupdate event in combo...that is effectively what I want to write.
customer fields: CustomerID, customername, country
order table fields: orderid, customerid, value
 
Upvote 0
I was trying the following code in afterevent:

Private Sub Combox_AfterUpdate()
Combox.Value = xx

Form.Value = xx

End Sub
didnt work at all
 
Upvote 0
You have tables Customer and Order.
Can you show me some output when you run this query? Only need a few records to get the datatypes.
Code:
SELECT
Customer.CustomerID
, Order.OrderID
, Order.Value
FROM Customer INNER JOIN Order ON
Customer.CustomerID = Order.CustomerID
 
Upvote 0
I allready has this, relationship setup in the database. The issue is I want to create a form. Om the form I insert a combo box lokkoimg up customer I'd and name. Based on this selection I want a subform with orders on the same form to be filtered on the customerid selected in the combo box...
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top