RTE 2101, The setting you entered isn't valid for this property (1 Viewer)

JamesMcS

Keyboard-Chair Interface
Local time
Today, 11:31
Joined
Sep 7, 2009
Messages
1,819
Hi all, bit of an annoying one (aren't they all):

I'm getting the above error when changing link criteria for a subform in VBA.

My form has 4 subforms - two to select a level of detail that's displayed in the third and fourth:
Select_MH2 & Select_MH3 are the high level product category selectors.
MH3_Sub and Material Detail Subform are the ones that show the detail for the category selected in the first two.

In the on enters of Select_MH2 and Select_MH3(detail level select subforms) I've got the following:
Code:
Private Sub Select_MH2_Enter()
MH3_Sub.SourceObject = "MH2 Mfr Overall Sub"
[COLOR=red][B]MH3_Sub.LinkMasterFields = ""[/B][/COLOR]
MH3_Sub.LinkChildFields = ""
 
MH3_Sub.LinkChildFields = "MH2"
MH3_Sub.LinkMasterFields = "MH2_Link"
 
[Material Detail Subform].LinkMasterFields = ""
[Material Detail Subform].LinkChildFields = ""
 
[Material Detail Subform].LinkMasterFields = "MH2_Link"
[Material Detail Subform].LinkChildFields = "MH2"
 
End Sub
 
----------------
 
Private Sub Select_MH3_Enter()
 
MH3_Sub.SourceObject = "MH3 Mfr Overall Sub"
 
MH3_Sub.LinkChildFields = ""
MH3_Sub.LinkMasterFields = ""
 
MH3_Sub.LinkMasterFields = "MH3_Link"
MH3_Sub.LinkChildFields = "MH3"
 
[Material Detail Subform].LinkMasterFields = ""
[Material Detail Subform].LinkChildFields = ""
 
[Material Detail Subform].LinkMasterFields = "MH3_Link"
[Material Detail Subform].LinkChildFields = "MH3"
 
End Sub
MH3_Sub is the mid level detail form and Material Detail Subform is the line level detail subform.

I think it's something to do with the order I've got it in, but swapping them around doesn't seem to make a difference. Am I missing an instruction? Or is it in the wrong event? Might have a play with that now actually......

Weirdly the code doesn't hang on Select_MH3_Enter, only Select_MH2_Enter, i.e. when I click in Select_MH3, the subforms all work fine, but when I enter Select_MH2, it hangs on the highlighted line above....

Thanks in advance!
 
Last edited:

dkinley

Access Hack by Choice
Local time
Today, 05:31
Joined
Jul 29, 2008
Messages
2,016
I believe it is a reference issue ...

You are trying to do something from Sub MH2 and apply it to Sub MH3, however, you are not supplying the path from MH2 to MH3 (the Parent).

I've done the same as you before but different implementation (from a module function) so I am swagging here, but it might need to be

Code:
Me.Parent.MH3_Sub.LinkMasterFields = ""

For references in situations such as these, bookmark this link.

-dK
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 11:31
Joined
Sep 7, 2009
Messages
1,819
Cheers DK - the code, which I should have mentioned earlier, is in the main form's module. I'll try an explicit reference now just to be sure, but it's odd that select_MH2_Enter produces the error, when select_MH3_Enter doesn't....

Thanks for the reply though! I've seen this problem posted plenty of time on t'interweb but can't see the solution...... grrrr!
 

dkinley

Access Hack by Choice
Local time
Today, 05:31
Joined
Jul 29, 2008
Messages
2,016
That may work. The only other thing I can think of is the name of the sub doesn't match. In all of my trials of doing the same sort of thing, I never got the error you are seeing.

I don't have access to some archived stuff where I had done exactly the same setup. Like I mentioned, I modified the current version to work from a module since I am doing exactly like you ... except alot of times.

-dK
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 11:31
Joined
Sep 7, 2009
Messages
1,819
Ah yes apologies again - both events control what's displayed in the subforms MH3_Sub and Material Detail Subform.

Useful link, I've saved that as a word doc a while back, has helped me and a lot of thread starters here!
 

dkinley

Access Hack by Choice
Local time
Today, 05:31
Joined
Jul 29, 2008
Messages
2,016
Is all good. I understand your question about the ordering - I remember running into the same issues.

I actually cleared the links, assigned the source, then assigned the linkage. The perplexing bit is that it works fine with your other one and it fails on clearing the links not assigning which leads me back to the subform name. But it works for the other one .... perplexing.

Any way to post the db?

-dK
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 11:31
Joined
Sep 7, 2009
Messages
1,819
It's a bit big to post unfortunately. I've done a bit more checking and it turns out that one of the tables might not be 100% (although this all worked fine last month... what have I done....) - so I'll have a look at that over the weekend and post back.

Thanks for looking at this DK!
 

chrisleblanc_org

New member
Local time
Today, 06:31
Joined
Mar 4, 2018
Messages
1
I was having the same issue.

If you go to the properties of the subform, the source object is set in this format:

Query.yourqueryname

I went back and set my code to use this naming syntax and it worked flawlessly.
 

Users who are viewing this thread

Top Bottom