473,671 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Unload/Close Randomness

Hi there,

I am currently working on converting a program from Access 97 to Access
2003. It all worked fine in 97, but there is some randomness in 2003
that I don't understand. I have a form, Main, that loads as follows in
the code:

1. In Main's Form_Load subroutine, the first line calls a routine
(PutTableOnSubf orm) that will load a data table's fields onto its
subform's (Template) form.
2. PutTableOnSubfo rm's first line opens the subform in hidden mode:
DoCmd.OpenForm "Template", acDesign, , , , acHidden
3. The rest of PutTableOnSubfo rm populates Template with the table's
fields (text boxes) and then the last line closes it up:
DoCmd.Close acForm, "Template", acSaveYes
4. Back in Main's Form_Load, the next chunk of code sets some of the
properties of the Me.subform control, like the source object (Template)
and the caption.

And then the rest of the code runs and the form loads up on the screen
fine.

My problem is, any time after the first time when I press the button to
load Main, I get run-time error 2467, "The expression you entered
refers to an object that is closed or doesn't exist".

When I step through the code on these subsequent loads, the step 2
above calls Main's form_Unload event and then the form_Close event. So
when it goes back to the form_Load event to do step 4 above, it hits
the runtime error entered.

Please tell me if I can supply any additional information in order to
get past this roadblock. Thank you in advance for your help.

Erika

Nov 13 '05 #1
2 2622
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In Access 2002 & higher a form can't be opened in design view when it is
being used as a subform in an open form. The reason it works the 1st
time is the subform's Source Object isn't defined. Perhaps, if you
nulled the subform's Source Object before opening the Template form in
design view, it would work.
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkxAtoechKq OuFEgEQK7wACfUB uEe458En7prtPmV YfsmRYsJDQAn1fw
ikF0IWsK3NqODST KB2fIamhf
=uXcF
-----END PGP SIGNATURE-----

mi******@gmail. com wrote:
Hi there,

I am currently working on converting a program from Access 97 to Access
2003. It all worked fine in 97, but there is some randomness in 2003
that I don't understand. I have a form, Main, that loads as follows in
the code:

1. In Main's Form_Load subroutine, the first line calls a routine
(PutTableOnSubf orm) that will load a data table's fields onto its
subform's (Template) form.
2. PutTableOnSubfo rm's first line opens the subform in hidden mode:
DoCmd.OpenForm "Template", acDesign, , , , acHidden
3. The rest of PutTableOnSubfo rm populates Template with the table's
fields (text boxes) and then the last line closes it up:
DoCmd.Close acForm, "Template", acSaveYes
4. Back in Main's Form_Load, the next chunk of code sets some of the
properties of the Me.subform control, like the source object (Template)
and the caption.

And then the rest of the code runs and the form loads up on the screen
fine.

My problem is, any time after the first time when I press the button to
load Main, I get run-time error 2467, "The expression you entered
refers to an object that is closed or doesn't exist".

When I step through the code on these subsequent loads, the step 2
above calls Main's form_Unload event and then the form_Close event. So
when it goes back to the form_Load event to do step 4 above, it hits
the runtime error entered.

Please tell me if I can supply any additional information in order to
get past this roadblock. Thank you in advance for your help.

Erika

Nov 13 '05 #2
Thank you so much!
I put the source object = "" before the puttableonsubfo rm line, and it
loads every time.
Thank you thank you thank you!

Nov 13 '05 #3

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

Similar topics

4
1935
by: V.Boomessh | last post by:
Hai can any one help me on this problem. I am new to VB.NET. I have 2 forms. (form1 and form2) On click of a button in form1 i want to show form2 and unload form1
3
3931
by: Mike | last post by:
I recently posted a question regarding a table built using an action query in VBA. I am still having trouble. I have tried saving a record as suggested by one post. The problem A form uses the new table as its recordsource. However, even when the form is closed using either the close button on the form title bar or using the docmd.close the form fails to release its connection to the table making it locked and unable to be dropped or...
19
3603
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the thing you know ;-) After discovering that access 2000 support form properties (I'm a
4
3703
by: MS | last post by:
Just a general question here re VBA. Can anyone explain the differences between "!" and "." when refering to a control? eg Me!TxtBox and Me.TxtBox. What is difference between "+" and "&" when working with strings. eg MyStr = "I have " & MyNumber & " apples." and MyStr = "I have " + MyNumber + " apples."
4
21532
by: Claudia Fong | last post by:
Hi, I have more than one forms in my program, and I would like to for example, in form1, I will call form2 and in form2 it will call form3. But the problem is when I call form2.Show, it does show the form2, but how can I unload form1? If I put form1.close, it will close everything. :(
10
1741
by: peter hansen | last post by:
I tried a couple of weeks ago but I'll try again :D I old VB6-days it was possible to unload a form bu using the Unload(Form) command. I have tried the Close-function but it'll unload the entire projekt. The reason why I am asking is that I am creating a program and I need a Splash-screen (like the tiny screen that appears when programs like Word starts), and when the Splash-screen has been loaded for a couple of seconds it should be...
5
7436
by: AP | last post by:
IS there a way to run a procedure if the users close access directly rather than closing a menu screen that I have built? There is an event that works on close for this form, but it doesnt seem to run if the form is open and the suer just closes access all together, is there a way around this? Thanks
4
13099
by: PW | last post by:
Hi, I want to add code to check if the user wants to save the record (fields are unbound) when they press the form's close (X) button. Is it possible to return the user to the form if there are editing errors? I am using Access 2003
1
1662
devonknows
by: devonknows | last post by:
Ok, i posted about forcing a form to unload, now since ive implemented that, when check1.value = true, when you close the form, it doesnt unload, when check1.value = false, it unloads perfectly and does all the ADO with it, but when check1.value = true its doing the ADO commands, but just not unloading, if anyone can shed some light would be most greatful. Kind Regards Devon. Module code. Option Explicit Public g_fmrSearch As...
0
8483
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8825
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8676
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6237
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.