Access 2003 >> Access 2007 (Run-time error 2467)

L

lan yu

Hi.

I'm trying out how our access 2003 applications work in access 2007.
Unfortunately, lots of forms refuse to open. Where the error occures
is Form_Current event, which contains something like

std = "SELECT ....."
Me.Subform_Name![Field Name].RowSource = std

The program reports an error: "Run-time error '2467': The expression
you entered refers to an object that is closed or doesn't exist."

Anyone has any ideas how to fix this?
 
D

Douglas J. Steele

Technically, that shouldn't work in Access 2003 either, but it wasn't quite
as sticky about the syntax.

To refer to a control on a subform, you need to use

Me!NameOfSubformControlOnParent.Form!NameOfControlOnSubform.RowSource

(in case it's not obvious, the difference is the .Form between the subform
control name and the control name)

Note that the name of the subform control on the parent form may be
different than the name of the form being used as the subform.
 
L

lan yu

Doug, thank you for reply.

Unfortunately, it still gives the same error.
I also tried
Me.Controls("NameOfSubformControlOnParent").Form
but it doesn't help.



Technically, that shouldn't work in Access 2003 either, but it wasn't quite
as sticky about the syntax.

To refer to a control on a subform, you need to use

Me!NameOfSubformControlOnParent.Form!NameOfControlOnSubform.RowSource

(in case it's not obvious, the difference is the .Form between the subform
control name and the control name)

Note that the name of the subform control on the parent form may be
different than the name of the form being used as the subform.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)


I'm trying out how our access 2003 applications work in access 2007.
Unfortunately, lots of forms refuse to open. Where the error occures
is Form_Current event, which contains something like
std = "SELECT ....."
Me.Subform_Name![Field Name].RowSource = std
The program reports an error: "Run-time error '2467': The expression
you entered refers to an object that is closed or doesn't exist."
Anyone has any ideas how to fix this?
 
D

Douglas J. Steele

Are you sure you're using the correct name for the subform control?

Also, is the control in question on the subform a combo box or list box?

Rather than showing fake names, what's the exact code you're trying to use?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


lan yu said:
Doug, thank you for reply.

Unfortunately, it still gives the same error.
I also tried
Me.Controls("NameOfSubformControlOnParent").Form
but it doesn't help.



Technically, that shouldn't work in Access 2003 either, but it wasn't
quite
as sticky about the syntax.

To refer to a control on a subform, you need to use

Me!NameOfSubformControlOnParent.Form!NameOfControlOnSubform.RowSource

(in case it's not obvious, the difference is the .Form between the
subform
control name and the control name)

Note that the name of the subform control on the parent form may be
different than the name of the form being used as the subform.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)


I'm trying out how our access 2003 applications work in access 2007.
Unfortunately, lots of forms refuse to open. Where the error occures
is Form_Current event, which contains something like
std = "SELECT ....."
Me.Subform_Name![Field Name].RowSource = std
The program reports an error: "Run-time error '2467': The expression
you entered refers to an object that is closed or doesn't exist."
Anyone has any ideas how to fix this?
 
L

lan yu

Yes, I'm using the correct name. The control name was the same as the
name of the form used as a subform. I changed the control name to be
sure that what I'm addressing is the control.
Right now the control name is: subfUchastki
The source object is:

The control in question is a combobox, but the progrm can't access the
form itself.
When I add watch for Me.subfUchastki.Form, it gives an error ("The
expression you entered refers to an object that is closed or doesn't
exist")
The code is as follows:

Private Sub Form_Current()
Dim std As String, kod As Integer
kod = Me. _ _
std = "SELECT [ ], , , ,
, [ ] FROM [ ] WHERE [
] = " & kod & " order by [ ], "
Me.subfUchastki.Form![ ].RowSource = std
Me.subfUchastki.Form![ ].RowSource = std
End Sub
 
D

Douglas J. Steele

Where are you entering that code? In the Current event of the parent form,
or the Current event of the form being used as the subform?

Assuming the Current event of the parent form, it should work. You might try
renaming the controls to non-Russian, just in case that's the issue.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


lan yu said:
Yes, I'm using the correct name. The control name was the same as the
name of the form used as a subform. I changed the control name to be
sure that what I'm addressing is the control.
Right now the control name is: subfUchastki
The source object is:

The control in question is a combobox, but the progrm can't access the
form itself.
When I add watch for Me.subfUchastki.Form, it gives an error ("The
expression you entered refers to an object that is closed or doesn't
exist")
The code is as follows:

Private Sub Form_Current()
Dim std As String, kod As Integer
kod = Me. _ _
std = "SELECT [ ], , , ,
, [ ] FROM [ ] WHERE [
] = " & kod & " order by [ ], "
Me.subfUchastki.Form![ ].RowSource = std
Me.subfUchastki.Form![ ].RowSource = std
End Sub
 
B

banty

Yes, I'm using the correct name. The control name was the same as the
name of the form used as a subform. I changed the control name to be
sure that what I'm addressing is the control.
Right now the control name is: subfUchastki
The source object is:

The control in question is a combobox, but the progrm can't access the
form itself.
When I add watch for Me.subfUchastki.Form, it gives an error ("The
expression you entered refers to an object that is closed or doesn't
exist")
The code is as follows:

Private Sub Form_Current()
Dim std As String, kod As Integer
kod = Me. _ _
std = "SELECT [ ], , , ,
, [ ] FROM [ ] WHERE [
] = " & kod & " order by [ ], "
Me.subfUchastki.Form![ ].RowSource = std
Me.subfUchastki.Form![ ].RowSource = std
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top