Combobox...selected value not replicated to subform

jakobt

Active Member
Joined
May 31, 2010
Messages
316
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)
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

rondeondo

Board Regular
Joined
Aug 15, 2012
Messages
156
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.
 

jakobt

Active Member
Joined
May 31, 2010
Messages
316
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.
 

jackd

Well-known Member
Joined
Oct 19, 2006
Messages
1,299
Office Version
  1. 365
What are the recordsources of the form and the subform?
 

jakobt

Active Member
Joined
May 31, 2010
Messages
316

ADVERTISEMENT

Recordsource of combobox: Blank
FORM:
Recordsource of form: Customer

Subform:
Sourse object: orders
link master fields: customerid
link child fields: Customerid
 

jackd

Well-known Member
Joined
Oct 19, 2006
Messages
1,299
Office Version
  1. 365
Design of Customer, Order Table? What fields are in these tables?
Do you have some AfterUpdate event code for the combo?
More info needed.
 

jakobt

Active Member
Joined
May 31, 2010
Messages
316

ADVERTISEMENT

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
 

jakobt

Active Member
Joined
May 31, 2010
Messages
316
I was trying the following code in afterevent:

Private Sub Combox_AfterUpdate()
Combox.Value = xx

Form.Value = xx

End Sub
didnt work at all
 

jackd

Well-known Member
Joined
Oct 19, 2006
Messages
1,299
Office Version
  1. 365
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
 

jakobt

Active Member
Joined
May 31, 2010
Messages
316
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...
 

Watch MrExcel Video

Forum statistics

Threads
1,122,964
Messages
5,599,069
Members
414,281
Latest member
Engjamal2021

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
Top