MASTER CHILD ERROR

ARW17

Board Regular
Joined
Oct 31, 2016
Messages
97
I made a form with the month in a combo box in the header. There are 2 columns ID (Month Number) and Month (Jan, Feb, etc.). I have column 1 bound. On my subform, I have a field called ENTRY_MO, which has a month number in it as well. I set the Master field as MONTH_COMBO and the Child as ENTRY_MO. When I change the selection in the combo box, my data filters, but when I have selected 2/Feb from the combo box, I'm getting ENTRY_MO = 1 in my subform. This works the whole way through. If I select 12 in the combo box, what filters is month 11. How is this possible?
1605127266304.png
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
1,989
Office Version
  1. 365
Platform
  1. Windows
Is the subform recordsource a table or query? If query, show the sql statement for the form. I don't think the issue is that your date format in regional settings is the cause if you are off by -1 after every combo selection.

Also, there is no AfterUpdate code on the combo, is there? If so, show that too.
 

ARW17

Board Regular
Joined
Oct 31, 2016
Messages
97
The subform recordsource is a table.

There's no code on the combo at all.
 

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
1,989
Office Version
  1. 365
Platform
  1. Windows
Then if the main and subform is bound I'm drawing a blank - unless your ENTRY_MO field is a lookup field in the table.
I don't know if this forum allows you to post a zipped db copy or not because I've never posted a question here but that would certainly help.
BTW, if the combo is just for filtering the subform data it should not be bound to anything.
 

ARW17

Board Regular
Joined
Oct 31, 2016
Messages
97

ADVERTISEMENT

Instead of using the key as the master, I put a MONTH_NO field in my MONTH table and bound that column, using it as the master. That worked. I don't understand why using the autogenerated key did not, but I'm happy to move on.
 
Solution

JonXL

Active Member
Joined
Feb 5, 2018
Messages
395
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Instead of using the key as the master, I put a MONTH_NO field in my MONTH table and bound that column, using it as the master. That worked. I don't understand why using the autogenerated key did not, but I'm happy to move on.
Good you got it working, but I still wonder...

How was the combobox set up? I believe the entries are indexed starting at 0. So if you're referencing that instead of the displayed value, it would explain your being off by 1 (a selection of 1 is really 0, 2 really 1, etc.).
 

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
1,989
Office Version
  1. 365
Platform
  1. Windows
I thought of that but dismissed it because there's no mention of using ListIndex or Selected properties, just that the bound column is 1. However, now I find this intriguing:
Instead of using the key as the master,
What key? A primary key? If so, perhaps that is off by one. Even that doesn't make a lot of sense to me because the combo has 2 columns with month number and month name. The pic shows the correct number in the combo so for my money, the problem must be what the subform month no field is bound to.
 

Watch MrExcel Video

Forum statistics

Threads
1,119,093
Messages
5,576,061
Members
412,696
Latest member
khanhvy31
Top