UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Can't Find Field "xyz" Referred To In You Expression, Access 2010    
 
   
SemiAuto40
post Mar 8 2018, 03:55 PM
Post#1



Posts: 640
Joined: 3-April 12
From: L.A. (lower Alabama)


I have a bound form frm_MethodsPending with a subform on it subfrm_PendingMethodFiles. I have a button on frm_MethodsPending to launch another form frm_MethodFilesList where I manipulate files which are the source for the subform subfrm_PendingMethodFiles. After adding/deleting files on frm_MethodFilesList there is a button btn_DoneEdit which closes frm_MethodFilesList and causes a requery of the subfrm_PendingMethodFiles. This works as planned....

However I have another unbound form where the exact same thing is put together yet I get this 'can't find field subfrm_MethodFiles referred to in my expression'! These 2 examples one works - what looks to be a duplicate does not! I have tried every permutation to requery the subfrm_MethodFiles on the second error generating form from every example of the correct syntax for requeries. Anybody see what might be wrong? The only real difference that I can come up with is that the working one is on a bound form and the one that can't seem to be requeried is on an unbound form. Is there a way to make this work?

Thanks.
Go to the top of the page
 
SemiAuto40
post Mar 8 2018, 04:26 PM
Post#2



Posts: 640
Joined: 3-April 12
From: L.A. (lower Alabama)


Disregard please. After an hour of beating my head against the desk I started to slowly reason through the error. I then found that the subform had been assigned a name by Access of 'Child26' by some default process. So indeed the database could not find that subform because it was named wrong. In my defense since I didn't name the sub form myself I had seen a couple of other properties that were using the name I had given the form before it "became" a subform.

I'm beat... but eventually fought through it. It really helps to know UtterAccess is there when I lose hope! uarulez2.gif
Go to the top of the page
 
orange999
post Mar 8 2018, 04:35 PM
Post#3



Posts: 1,872
Joined: 10-February 08
From: Ottawa, Ont, Canada; West Palm Beach, FL


Good old perseverance pays off --again!
Go to the top of the page
 
GroverParkGeorge
post Mar 9 2018, 03:22 AM
Post#4


UA Admin
Posts: 34,132
Joined: 20-June 02
From: Newcastle, WA


Congratulations on finding the culprit.

The problem you encountered isn’t common, but not unheard of.

A subform control is actually just that, a control on a form. It can contain any form. Normally when you first create one with the control wizard, Access uses the name of the form used to drop it on the form it for the control which holds it. That’s the default, but obviously it can be something else. In fact, you can create a sub form control with no subform in it at all! Or you can create one subform control an replace the subform in it with VBA.

So what happened here might indicate you created a subform control with a subform in it and later copied that subform control to a second one. The name would already be taken, so Access had no choice but to use a default name for it. It usually becomes something like “ControlTypeXX” where XX is a digit or two.

Some developers might handle this by using a different name for the subform control than the subform in it. Eg ctlFarmAnimals contains sfrmFarmAnimals. That way it’s clear which is which. Or they might create a generic name for a sub form control and load different forms at different times using VBA. This is a bit strained for an example but perhaps ctlClient might contain either sfrmCommercialClient or sfrmResidentialClient.

In any event, what you saw is perfectly normal, if a bit rare.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th December 2018 - 12:24 AM