Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > On Unload < Copy To Clipboard | Force New Page >
Back to On Unload    Comments List
click X twice to close Upload Images   Link   Email  
Sami Shamma               
2 months ago
This has stumped me.
I have this simple code in the unload event of a form.


Private Sub Form_Unload(Cancel As Integer)
    Me.Refresh
    If IsNull(ReportDate) Or ReportDate = "" Then
        MsgBox "You Must enter a date!", vbCritical, "Missing Date"
        Cancel = True
    End If
End Sub



The records in this form are preloaded.
The user must enter a date before he exits.

When closing the form, the code works correctly:
1) the record already has a date. it closes.
2) the record dose NOT have a date. Magbox is displayed.

But if after the msgbox is displayed and a date is entered, I have to click the "X" twice for the form to close.

I thought it may have to do with the record being dirty, so I added me.refresh, but that was not the problem.

I do not understand what is happing with the timing. I tried trapping what is happing without succuss.
Adam Schwanz             
2 months ago
Works perfectly fine for me. Is there any other events going on?

Way out there question and unlikely if the rest of your forms work, but it kind of reminds me of a focus issue, like with zoom remote control you have to actually click into the program once to register your interacting, and then your second click registers as an action. Out of curiosity, does it still do it if you click the form once and then the X once?
Sami Shamma               
2 months ago
Adam,

You are on to something. If I click on the form once and then click the "X," it closes.
Sami Shamma               
2 months ago

Sami Shamma               
2 months ago
this form has three subforms:
Program Numbers.
Cancellations.
Outcomes.

all one-to-many with proper ChaplainID as foreign keys to the other three tables
Adam Schwanz             
2 months ago
Welp, I wasn't really expecting that lol. If thats what it is I'm not sure how to address that, are you doing this on your local machine or is it through some kind of remote connection that could be interfering? Before you go down that probably red herring though, are there any events in the subforms that would interfere?
Adam Schwanz             
2 months ago
I figured it out, if you use the date picker to select the date, it seems to act like its lost the focus, I can get it to repeat what you're saying is happening with needing 2 clicks if I use the built-in date picker instead of typing in the value. Don't have any ideas off the top of my head on how to interact with that other than to say make your own datepicker calendar
Sami Shamma               
2 months ago
Now I am connected to my office computer through remote connection from home.
Everything in this form is vanilla.  There are no events running anywhere on this form.
All the data is preloaded on the main form and two sub forms. The only sub that is not preloaded is cancellations.
Sami Shamma               
2 months ago
Bingo. It is the goddamn date picker.  
I believe Richard has developed one somewhere, I'll find it.

Many thanks my friend
Sami Shamma               
2 months ago
Richard and Alex

Did you ever develop your own date picker?
I have the feeling that I've seen one on one of the videos!
Adam Schwanz             
2 months ago
I know theres one in the Access Calendar Seminar
Sami Shamma               
2 months ago
Thanks. I will look for it.
Adam Schwanz             
2 months ago
Theres THIS too
Sami Shamma               
2 months ago
Yes that's the one.
Funny, I couldn't find it in the search of the index
Kevin Yip       
2 months ago
This is probably better done with the form's BeforeUpdate event.  If the user tries to close the form without a proper entry, BeforeUpdate kicks in and prevents the UnLoad event from even running.
Sami Shamma               
2 months ago
Thank you, Kevin. I will try that.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in On Unload.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/24/2024 6:37:54 AM. PLT: 1s