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 
Button Command
Michelle Mayo 
     
14 months ago
I have a form (EmployeeF) that has 2 buttons: Accesses and Requests.
I have a 2nd form (AccessesF) that has 2 buttons: Employee and Requests
I have a 3rd form (Requests) that has 2 buttons: Employee and Accesses

When on the AccessesF, if I click on either Employee or Requests, I want the AccessesF to save and close and whatever button I click on to open.
When on the RequestsListF, if I click on either Employee or Accesses, I want the RequesetsListF to save and close and whatever button I click on to open.

On the AccessesF, here is the code for the buttons:
Private Sub Requests_Button_Click()
     DoCmd.OpenForm "RequestListF", , , "EmployeeT.ID=" & ID

Private Sub EmployeeButton_Click()
    DoCmd.OpenForm "EmployeeF", , , "ID=" & ID

On the RequestListF, here is the code for the buttons:
Private Sub AccessesButton_Click()
    DoCmd.OpenForm "AccessesF", , , "ID=" & ID

Private Sub EmployeeButton_Click()
    DoCmd.OpenForm "EmployeeF", , , "ID=" & ID

Is that possible?




Sami Shamma  @Reply  
             
14 months ago
1) Name your ID field properly, this will save you time and prevent errors and extra coding, i.e. EmployeeID, RequistID etc.
2) Send screenshots of your tables in design view.
3) Yes, it is possible
John Campbell  @Reply  
     
14 months ago
1. Copy the below code into a Global Module.

Function IsLoaded(strFrmName As String) As Boolean
    
    ''This function determines if a form is loaded.
    
    Const conFormDesign = 0
    Dim intX As Integer
        
    IsLoaded = False
    For intX = 0 To Forms.Count - 1
        If Forms(intX).FormName = strFrmName Then
            If Forms(intX).CurrentView <> conFormDesign Then
                IsLoaded = True
                Exit Function  ' Quit function once form has been found.
            End If
        End If
    Next
    
End Function

2. Then use/edit the below code to close and then open whatever form your want.

John Campbell  @Reply  
     
14 months ago
I hit enter too soon.

1. Save into global module above.

2. Then create a button the form you want to open or close anything.

If IsLoaded("AccessF") Then
        DoCmd.Close acForm, "AccessF"
        Docmd.OpenForm,"EmployerF"
End If

You can also use the isloaded in the opposite way

If Notisloaded("AccessF") then
Docmd openform, "AccessF"
End if
Michelle Mayo OP  @Reply  
     
14 months ago

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/6/2026 4:05:32 PM. PLT: 1s