Form can't find its components!

W

WoundUpDJ

The following line of code fails when trying to run an Access application
under Windows 2000. Error is "The expression you entered refers to an object
that is closed or does not exist". The subform is included in the form that
loaded!
____________________________________
Sub Form_Open(Cancel As Integer) 'Form Frm_Project_main
|
|
Forms![frm_Project_main]![Sub_ProjectTab_frm_Project_forecast].Form![ProjCode_Label].Caption = "Project No:"
_____________________________________

The problem does not affect all users- anyone have any clues as to what to
look for?
 
S

Steve

Sub_ProjectTab_frm_Project_forecast needs to be the name of the subform
control on the main form NOT the name of the subform itself.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]
 
K

Klatuu

In addition to Steve's answer, I would also suggest you move the code to the
form Load event. The Open event may be too soon for the form to know about
all its components.
 
G

George Nicholson

PC Datasheet:

Seems to me that since the OP said: "...the problem does not affect all
users..." your boilerplate response isn't applicable.




Steve said:
Sub_ProjectTab_frm_Project_forecast needs to be the name of the subform
control on the main form NOT the name of the subform itself.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]




WoundUpDJ said:
The following line of code fails when trying to run an Access application
under Windows 2000. Error is "The expression you entered refers to an
object
that is closed or does not exist". The subform is included in the form
that
loaded!
____________________________________
Sub Form_Open(Cancel As Integer) 'Form Frm_Project_main
|
|
Forms![frm_Project_main]![Sub_ProjectTab_frm_Project_forecast].Form![ProjCode_Label].Caption
= "Project No:"
_____________________________________

The problem does not affect all users- anyone have any clues as to what
to
look for?
 
S

Steve

First of all, if you are being critical, why didn't you apply the same
comment to Klatuu's response? Your same criticism applies to his response
too!!

Second of all, rather than being critical, why didn't you give the Op an
answer if you know so much??

Steve



George Nicholson said:
PC Datasheet:

Seems to me that since the OP said: "...the problem does not affect all
users..." your boilerplate response isn't applicable.




Steve said:
Sub_ProjectTab_frm_Project_forecast needs to be the name of the subform
control on the main form NOT the name of the subform itself.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]




WoundUpDJ said:
The following line of code fails when trying to run an Access
application
under Windows 2000. Error is "The expression you entered refers to an
object
that is closed or does not exist". The subform is included in the form
that
loaded!
____________________________________
Sub Form_Open(Cancel As Integer) 'Form Frm_Project_main
|
|
Forms![frm_Project_main]![Sub_ProjectTab_frm_Project_forecast].Form![ProjCode_Label].Caption
= "Project No:"
_____________________________________

The problem does not affect all users- anyone have any clues as to what
to
look for?
 
S

Steve

Open frm_Project_main in design view. Select the border that surrounds your
subform. Click on the Properties icon in the menu at the top of the screen.
Go to the Other tab. What is in the Name property?

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]
 
G

George Nicholson

Dave's response was the same as mine would have been: try using the Load
event instead since it's clearly a timing issue.



Steve said:
First of all, if you are being critical, why didn't you apply the same
comment to Klatuu's response? Your same criticism applies to his response
too!!

Second of all, rather than being critical, why didn't you give the Op an
answer if you know so much??

Steve



George Nicholson said:
PC Datasheet:

Seems to me that since the OP said: "...the problem does not affect all
users..." your boilerplate response isn't applicable.




Steve said:
Sub_ProjectTab_frm_Project_forecast needs to be the name of the subform
control on the main form NOT the name of the subform itself.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]




The following line of code fails when trying to run an Access
application
under Windows 2000. Error is "The expression you entered refers to an
object
that is closed or does not exist". The subform is included in the form
that
loaded!
____________________________________
Sub Form_Open(Cancel As Integer) 'Form Frm_Project_main
|
|
Forms![frm_Project_main]![Sub_ProjectTab_frm_Project_forecast].Form![ProjCode_Label].Caption
= "Project No:"
_____________________________________

The problem does not affect all users- anyone have any clues as to what
to
look for?
 
Top