473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

use of Me. gives RunTime error

Hi!

When using the "me." keyword (for ex. me.FilterOn = True), I sometimes
(not always) get the error message:
"The expression yuo entered refers to an object that is closed or
doesn't exist."

I really wonder why. I use it in a Form-module, to reference the form
itself. The form is used as a subform in another form. Could that be
the reason?

Please help!
-Olaf

Nov 13 '05 #1
6 1493
I'm surprised that it works at any time. Below is a handy sheet to correct
syntax.



Syntax for main/subforms

For these examples:

Mainform is the name of the top level form

Subform1 is the name of the subform CONTROL on mainform

Subform2 is the name of the subform CONTROL on the 1st subform.


If you are on

Main form
Sub 1

To refer to a form property, like RecordSource

On Mainform
Me.RecordSource
Me.Parent.RecordSource

On Sub 1
Me!Subform1.Form.RecordSource
Me.RecordSource

On Sub 2
Me!Subform1.Form!Subform2.Form.

RecordSource
Me!Subform2.Form.RecordSource

To refer to a control

On Mainform
Me!ControlName
Me.Parent!ControlName

On Sub 1
Me!Subform1.Form!ControlName
Me!ControlName

On Sub 2
Me!Subform1.Form!Subform2.Form!

ControlName
Me!Subform2.Form!ControlName

To refer to a control property, like Enabled

On Mainform
Me!ControlName.Enabled
Me.Parent!ControlName.Enabled

On Sub 1
Me!Subform1.Form!ControlName.Enabled
Me!ControlName.Enabled

On Sub 2
Me!Subform1.Form!Subform2.Form!

ControlName.Enabled
Me!Subform2.Form!ControlName.Enabled

To refer to a subform control property, like SourceObject

On Mainform
N/A
N/A

On Sub 1
Me!Subform1.SourceObject
N/A

On Sub 2
Me!Subform1.Form!Subform2.SourceObject
Me!Subform2.SourceObject


If you are on

Sub2
Not in these forms

To refer to a form property, like RecordSource

On Mainform
Me.Parent.Parent.RecordSource
Forms!Mainform.RecordSource

On Sub 1
Me.Parent.RecordSource
Forms!Mainform!Subform1.Form.RecordSource

On Sub 2
Me.RecordSource
Forms!Mainform!Subform1.Form!Subform2.

Form.RecordSource

To refer to a control

On Mainform
Me.Parent.Parent!ControlName
Forms!Mainform!ControlName

On Sub 1
Me.Parent!ControlName
Forms!Mainform!Subform1.Form!ControlName

On Sub 2
Me!ControlName
Forms!Mainform!Subform1.Form!Subform2.

Form!ControlName

To refer to a control property, like Enabled

On Mainform
Me.Parent.Parent!ControlName.Enabled
Forms!Mainform!ControlName.Enabled

On Sub 1
Me.Parent!ControlName.Enabled
Forms!Mainform!Subform1.Form!ControlName.Enabled

On Sub 2
Me!ControlName.Enabled
Forms!Mainform!Subform1.Form!Subform2.

Form!ControlName.Enabled

To refer to a subform control property, like SourceObject

On Mainform
N/A
N/A

On Sub 1
N/A
Forms!Mainform!Subform1.SourceObject

On Sub 2
N/A
Forms!Mainform!Subform1.Form!Subform2.

SourceObject


"olaf" <ol***@runit.no> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi!

When using the "me." keyword (for ex. me.FilterOn = True), I sometimes
(not always) get the error message:
"The expression yuo entered refers to an object that is closed or
doesn't exist."

I really wonder why. I use it in a Form-module, to reference the form
itself. The form is used as a subform in another form. Could that be
the reason?

Please help!
-Olaf

Nov 13 '05 #2
"Ed Robichaud" <ed*********@wdn.com> wrote in
news:bt*****************@monger.newsread.com:
I'm surprised that it works at any time. Below is a handy sheet
to correct syntax.


How completely idiotic.

Of course, Me.FilterOn should work in the module of a subform.

If you want to check it from outside that context, say while the
main form with the embedded subform is open, you can test it from
the Debug window with:

Forms!MainForm!SubForm.Form.FilterOn

Now, I've seen some complexities with filters in subforms, but
nothing that's insurmountable. Perhaps if the original poster could
indicate what exact line is causing the error, it would be more
easily diagnosable.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3

"Ed Robichaud" <ed*********@wdn.com> wrote in message
news:bt*****************@monger.newsread.com...
I'm surprised that it works at any time. Below is a handy sheet to
correct syntax.


Ed--Disregard David's post. He's having his period. (His asshole is
bleeding.) --Cathy
Nov 13 '05 #4
You probably should have mentioned that what you posted was copied from
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web". In that
way, he could go there and see it formatted (and even download the doc
version)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Ed Robichaud" <ed*********@wdn.com> wrote in message
news:bt*****************@monger.newsread.com...
I'm surprised that it works at any time. Below is a handy sheet to
correct syntax.
"olaf" <ol***@runit.no> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi!

When using the "me." keyword (for ex. me.FilterOn = True), I sometimes
(not always) get the error message:
"The expression yuo entered refers to an object that is closed or
doesn't exist."

I really wonder why. I use it in a Form-module, to reference the form
itself. The form is used as a subform in another form. Could that be
the reason?

Please help!
-Olaf


Nov 13 '05 #5

According to Arvin Meyer MCP (Master Certified Plagiarist) you don't have to
mention where you stole stuff from.

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:vo********************@rogers.com...
You probably should have mentioned that what you posted was copied from
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web". In that
way, he could go there and see it formatted (and even download the doc
version)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Ed Robichaud" <ed*********@wdn.com> wrote in message
news:bt*****************@monger.newsread.com...
I'm surprised that it works at any time. Below is a handy sheet to
correct syntax.
"olaf" <ol***@runit.no> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi!

When using the "me." keyword (for ex. me.FilterOn = True), I sometimes
(not always) get the error message:
"The expression yuo entered refers to an object that is closed or
doesn't exist."

I really wonder why. I use it in a Form-module, to reference the form
itself. The form is used as a subform in another form. Could that be
the reason?

Please help!
-Olaf



Nov 13 '05 #6
Thanks; I couldn't find that web page reference, but thought I'd sent the
info in HTML to preserve the doc formatting.
-Ed

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:vo********************@rogers.com...
You probably should have mentioned that what you posted was copied from
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web". In that
way, he could go there and see it formatted (and even download the doc
version)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Ed Robichaud" <ed*********@wdn.com> wrote in message
news:bt*****************@monger.newsread.com...
I'm surprised that it works at any time. Below is a handy sheet to
correct syntax.
"olaf" <ol***@runit.no> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi!

When using the "me." keyword (for ex. me.FilterOn = True), I sometimes
(not always) get the error message:
"The expression yuo entered refers to an object that is closed or
doesn't exist."

I really wonder why. I use it in a Form-module, to reference the form
itself. The form is used as a subform in another form. Could that be
the reason?

Please help!
-Olaf



Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
2
by: Rashida | last post by:
Hi all! I have written a function to fetch lebels from xml file for cross-language interoperability. Please refer function code below. I am invoking itfrom my asp page saying...
1
by: Jo Schambach | last post by:
I wrote a python GUI with tkInter and installed it on a windows machine with the .pyw extension, so it will be executed from pythonw.exe instead of python.exe, since I didn't want the console...
5
by: Nathan Bloom | last post by:
Hi, I have a secured database that runs fine on the computer the database is installed on. I have several workstations with access runtime installed that also need access to the database. ...
2
by: Robert A. van Ginkel | last post by:
I have a strange C# problem. Is the following a bug? Because it should be possible to run unsafe code. How can I accomplish this? And where can I read more about this, because documentation on this...
3
by: rob2 | last post by:
I have written a C# application that runs fine from within the IDE, and also when I invoke it via the Windows 'Run' dialog or from explorer. I am trying to make the app launch automatically when...
4
by: IMS.Rushikesh | last post by:
Hi All, I am trying to execute below code but it gives me an COMException ///// Code Start //// public string GetName(Excel.Range range) { try { if (range.Name != null)
1
by: Robin Dindayal | last post by:
Does anyone know how I can print a fully rendered .aspx to the server's printer? I know that, if I wanted to print to the client's printer it would be easy (ie. use javascript's window.print()). ...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
2
by: JamesB | last post by:
Hi I have sent my app to test with one of our people and it works fine, but when put into a customer's PC, it comes up with a FileIOException (file not found) as soon as it is run. I've gone...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.