Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Form Automation
Scott Adkins 

14 years ago
Hello again all. I am working with a form that I want to open up in drive. The problem I am having(at least I think) is the cart is out-running the horse.

When I open the form, I want it to go into a loop that collects information from another form without any interaction.

What I think I am finding is, despite clearly laying out the code in a manner consistent with what I want to happen, VBA seems to be jumping around and doing its own thing.

So 2 questions:
Is there a way to control the order of events going on?

Or, is there a down and dirty way to look to see if a form is open and ready to accept information?


Reply from Richard Rost:

The order of events is easy... Access VBA code executes asynchronously - meaning one line after another. One form won't give up it's sequence of events to another form, or jump to a different event in the same form, until execution is finished. So you shouldn't be having problems with multiple things happening at the same time UNLESS you've got something like a DoCmd.DoEvents command in there.

Yes, you can check to see if a form is open just by trying to read a value from it. You can say: If ISNULL(Forms!SomeForm!AutoNumberField) then you can assume the form is not opened OR at least on a blank record. It's quick and dirty, but it's simple.

A not-so-simple but BETTER way is to use this IsLoaded function. It will tell you FOR SURE if a form is open or not:

Function Isloaded(ByVal strFormName As String) As Integer
' Returns True if the specified form is open in Form view or Datasheet view.
    
    Const conObjStateClosed = 0
    Const conDesignView = 0
    
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
        If Forms(strFormName).CurrentView <> conDesignView Then
            Isloaded = True
        End If
    End If
    
End Function

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

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/17/2026 7:49:47 AM. PLT: 0s