A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Referring to a subform in code:Error 2455



 
 
Thread Tools Display Modes
  #1  
Old December 13th, 2006, 12:06 AM posted to microsoft.public.access.forms
Warmy
external usenet poster
 
Posts: 3
Default Referring to a subform in code:Error 2455

I have a form with no recordsource that has to continious forms on it. We can
call them fsub1 and fsub2. I have code underneath the fsub1.OnCurrent to
update the recordset on fsub2. Here's what I've tried:
Me.Parent.Controls("fsub2").Form.RecordSource = sSQL
Forms!frmInHouseInventory!fsub2.Form.RecordSource = sSQL
Forms("frmInHouseInventory").Controls("fsub2").For m.RecordSource = sSQL

I keep getting error #2455. Invalid reference to a form.

TIA
--Warmy
  #2  
Old December 13th, 2006, 04:14 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Referring to a subform in code:Error 2455

Open the main form in design view.
Right-click the edge of the 2nd subform, and choose Properties.
What is the Name property of this subform?
It may not be the same as the name of the form that gets loaded into it (its
SourceObject.)

If the name is correct, when do you get this error? Is it when the form
first loads? Access has to load one of the subforms before the other, so the
message may indicate that the other subform has not loaded yet when the
first subform's Current event fires first.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Warmy" wrote in message
...
I have a form with no recordsource that has to continious forms on it. We
can
call them fsub1 and fsub2. I have code underneath the fsub1.OnCurrent to
update the recordset on fsub2. Here's what I've tried:
Me.Parent.Controls("fsub2").Form.RecordSource = sSQL
Forms!frmInHouseInventory!fsub2.Form.RecordSource = sSQL
Forms("frmInHouseInventory").Controls("fsub2").For m.RecordSource = sSQL

I keep getting error #2455. Invalid reference to a form.

TIA
--Warmy



  #3  
Old December 13th, 2006, 04:29 PM posted to microsoft.public.access.forms
Warmy
external usenet poster
 
Posts: 3
Default Referring to a subform in code:Error 2455

So I can assume that Access loads it forms alphabetically since I having
problems referring to the latter form.

"Allen Browne" wrote:

Open the main form in design view.
Right-click the edge of the 2nd subform, and choose Properties.
What is the Name property of this subform?
It may not be the same as the name of the form that gets loaded into it (its
SourceObject.)

If the name is correct, when do you get this error? Is it when the form
first loads? Access has to load one of the subforms before the other, so the
message may indicate that the other subform has not loaded yet when the
first subform's Current event fires first.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Warmy" wrote in message
...
I have a form with no recordsource that has to continious forms on it. We
can
call them fsub1 and fsub2. I have code underneath the fsub1.OnCurrent to
update the recordset on fsub2. Here's what I've tried:
Me.Parent.Controls("fsub2").Form.RecordSource = sSQL
Forms!frmInHouseInventory!fsub2.Form.RecordSource = sSQL
Forms("frmInHouseInventory").Controls("fsub2").For m.RecordSource = sSQL

I keep getting error #2455. Invalid reference to a form.

TIA
--Warmy




  #4  
Old December 13th, 2006, 04:38 PM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Referring to a subform in code:Error 2455

The loading order is not defined anywhere I am aware of.

In practice, I suspect it's in the order you placed the controls to the
form.

You could try programmatically looping through the Controls collection of
the form to see if it matches that order.

If it is just the initial load that generates the problem, you could use
error handling to ignore the error.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Warmy" wrote in message
...
So I can assume that Access loads it forms alphabetically since I having
problems referring to the latter form.

"Allen Browne" wrote:

Open the main form in design view.
Right-click the edge of the 2nd subform, and choose Properties.
What is the Name property of this subform?
It may not be the same as the name of the form that gets loaded into it
(its
SourceObject.)

If the name is correct, when do you get this error? Is it when the form
first loads? Access has to load one of the subforms before the other, so
the
message may indicate that the other subform has not loaded yet when the
first subform's Current event fires first.

"Warmy" wrote in message
...
I have a form with no recordsource that has to continious forms on it.
We
can
call them fsub1 and fsub2. I have code underneath the fsub1.OnCurrent
to
update the recordset on fsub2. Here's what I've tried:
Me.Parent.Controls("fsub2").Form.RecordSource = sSQL
Forms!frmInHouseInventory!fsub2.Form.RecordSource = sSQL
Forms("frmInHouseInventory").Controls("fsub2").For m.RecordSource = sSQL

I keep getting error #2455. Invalid reference to a form.

TIA
--Warmy






  #5  
Old December 13th, 2006, 11:44 PM posted to microsoft.public.access.forms
DawnTreader
external usenet poster
 
Posts: 198
Default Referring to a subform in code:Error 2455

Hello guys

i have had an error that i think has to do with timing as well. I have a
form with lots of subforms. Lots. A lot of the subforms are on tab controls.
A few tabs are “hidden” as the user enters the main form. The reason they are
hidden is because they are for different types of products. So on each tab,
hidden or not, there are subforms. Those subforms have a tab control on them,
with subforms on those tabs. There are no hidden tabs at this level, but I
just want to be clear about the levels.

i get error 2455 a total of 6 times before the main form will open. i
thought that it might be once for each hidden tab, but that would be 4, i
thought maybe the hidden subforms were the problem, but that would be 4,
unless it was going to the subsubforms, but then that would be more around 12
to 14. at this point i am wondering if there is an adjustment that i can make
somewhere to the code to allow everything to load and stop the locking code
from having trouble running?

additionally i was thinking that maybe it was because of the way some
subforms are pulling data that is at the same level as my main form. i think
of them as reverse subforms.

if there are any ideas about why i get this error, please, let me know.

"Allen Browne" wrote:

The loading order is not defined anywhere I am aware of.

In practice, I suspect it's in the order you placed the controls to the
form.

You could try programmatically looping through the Controls collection of
the form to see if it matches that order.

If it is just the initial load that generates the problem, you could use
error handling to ignore the error.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Warmy" wrote in message
...
So I can assume that Access loads it forms alphabetically since I having
problems referring to the latter form.

"Allen Browne" wrote:

Open the main form in design view.
Right-click the edge of the 2nd subform, and choose Properties.
What is the Name property of this subform?
It may not be the same as the name of the form that gets loaded into it
(its
SourceObject.)

If the name is correct, when do you get this error? Is it when the form
first loads? Access has to load one of the subforms before the other, so
the
message may indicate that the other subform has not loaded yet when the
first subform's Current event fires first.

"Warmy" wrote in message
...
I have a form with no recordsource that has to continious forms on it.
We
can
call them fsub1 and fsub2. I have code underneath the fsub1.OnCurrent
to
update the recordset on fsub2. Here's what I've tried:
Me.Parent.Controls("fsub2").Form.RecordSource = sSQL
Forms!frmInHouseInventory!fsub2.Form.RecordSource = sSQL
Forms("frmInHouseInventory").Controls("fsub2").For m.RecordSource = sSQL

I keep getting error #2455. Invalid reference to a form.

TIA
--Warmy






  #6  
Old December 14th, 2006, 12:41 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Referring to a subform in code:Error 2455

If the error occurs only at the start (i.e. when you initially load the
form), and your code does refer to other subforms (which may not yet be
loaded), then yes, this probably the issue.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DawnTreader" wrote in message
...
Hello guys

i have had an error that i think has to do with timing as well. I have a
form with lots of subforms. Lots. A lot of the subforms are on tab
controls.
A few tabs are "hidden" as the user enters the main form. The reason they
are
hidden is because they are for different types of products. So on each
tab,
hidden or not, there are subforms. Those subforms have a tab control on
them,
with subforms on those tabs. There are no hidden tabs at this level, but I
just want to be clear about the levels.

i get error 2455 a total of 6 times before the main form will open. i
thought that it might be once for each hidden tab, but that would be 4, i
thought maybe the hidden subforms were the problem, but that would be 4,
unless it was going to the subsubforms, but then that would be more around
12
to 14. at this point i am wondering if there is an adjustment that i can
make
somewhere to the code to allow everything to load and stop the locking
code
from having trouble running?

additionally i was thinking that maybe it was because of the way some
subforms are pulling data that is at the same level as my main form. i
think
of them as reverse subforms.

if there are any ideas about why i get this error, please, let me know.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.