Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Open Form from Combo Box
Michelle Mayo 
     
3 years ago
I have a database that lists all of my employees names and then buttons for accesses, administrative paperwork, trainings, etc. Each employee has a particular type of access based on the department they work in.  I've created forms based off of that (PC access, HLOC Access, OP Access, etc.)
I want to make my Accesses button a drop down (or combo box). When I have an employee that works in the PC department, I want to select PC Access from the combo box and have that particular field open up.

I currently have this code, but when I select one, all of the forms open up behind each other.  How do I fix this?
   DoCmd.OpenForm "After Hours Access", , , "ID=" & ID
   DoCmd.OpenForm "HLOC - Cypress Access", , , "ID=" & ID
   DoCmd.OpenForm "HLOC - Irving Access", , , "ID=" & ID
   DoCmd.OpenForm "OP - Cypress Access", , , "ID=" & ID
   DoCmd.OpenForm "OP - Irving Access", , , "ID=" & ID
   DoCmd.OpenForm "PC - Cypress Access", , , "ID=" & ID
   DoCmd.OpenForm "PC - Irving Access", , , "ID=" & ID
   DoCmd.OpenForm "Transcriptionist", , , "ID=" & ID
Kevin Robertson  @Reply  
          
3 years ago
Are the forms significantly different? Would a single table (with a helper table) and form be possible?
Too Many Tables

If you do need all those forms I would use a Select Case based on what is selected in the Combo Box to determine which Form to open.
Gary James  @Reply  
      
3 years ago
if this is your code, exactly as it appears above, then each line is being executed one after the other.   This code needs to be moved inside a Select Case code block where you test the ID value from the Combobox and only run the DoCmd for that ID.

Select Case ID
   Case 1  ' After Hours Access ID=1
      DoCmd.OpenForm "After Hours Access", , , "ID=" & ID

   Case 2  ' HLOC - Cypress Access ID=2
      DoCmd.OpenForm "HLOC - Cypress Access", , , "ID=" & ID

     ...

End Select
Richard Rost  @Reply  
          
3 years ago
Yep... what those guys said... or you could use a classic If Then block if that's less confusing.

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

Next Unseen

 
 
What's This?

 

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: 9/12/2026 3:34:07 PM. PLT: 1s