473,399 Members | 2,146 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,399 software developers and data experts.

Code to make form unload itself

Hello, All.

I'm embarrassed to even ask this question because it seems like such a simple thing. But, here it is …

What is the code to make a form unload itself?

I have a form with a number of controls and buttons on it. When the user clicks the button ‘A’, I want the form to close itself. I’ve tried using the “Unload” statement, but Access 2002 doesn’t like it. I get a #361 run-time error.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button_A_Click()
  2. Unload Me
  3. Exit Sub
Can anyone toss me a bone on this one? I’m sick of spinning my wheels on this.

Humbly,
Scott
May 16 '07 #1
3 13559
Denburt
1,356 Expert 1GB
You can close the form using the following method.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button_A_Click()
  2. DoCmd.Close
  3. exit sub
If you have code that you would like to run in the unload event then you can call the unload event using the following:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button_A_Click() 
  2. Form_Unload False
  3. exit sub
May 16 '07 #2
Ugh! I knew it was going to be something simple!

Thanks for helping!

Scott
May 16 '07 #3
Denburt
1,356 Expert 1GB
It's my pleasure! :)
May 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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 "&"...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
10
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...
15
by: carr4895 | last post by:
Hello. I was wondering if someone could help me too with a login form. Upon startup, I have to display a password screen and it should accept a user name and password. User name can be anything...
6
by: Calligra | last post by:
have a form which looks at the title of the workbook saved on a different workbook, determines whether or not information has been inputted previously and then asks the user if the information is...
1
by: Donkey Cart Racer | last post by:
Hi, I have a page - page1 which opens a window1 where users can look at tasks, in window1 users can click and open window2 where they can create new tasks I want to refresh window1 when...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
0
vdraceil
by: vdraceil | last post by:
Hi,i use VB6.0..is it possible to prevent a form from unloading ever? I know to set cancel=true in query unload event of the form..but this applies only to limited cases. If my exe is closed from...
6
vdraceil
by: vdraceil | last post by:
I use vb6.i have a small problem guys..my form is not unloading. I want my application to end only if the user presses shift+F10.so i run a timer with interval=1 which checks the keyboard state of...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.