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 ZIP Code Template    Comments List
Pending Approval    Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 

Anonymous 
 
Richard Rost  @Reply  
          
6 years ago
Yeah, that's a limitation of how I built it. A trick I've used to make a form flexible so it can be called from any number of different forms is to store the name of the CALLING form (the form that opened it) in a hidden field on ZipLookupF. So you might have:

Docmd.OpenForm "ZipLookupF"
Forms!ZipLookupF!HiddenCallingFormName = "ClientF"

Now in the ZipLookupF instead of "hard coding" CustomerF, you could say:

Forms(HiddenCallingFormName)!City = City
Forms(HiddenCallingFormName)!State = State

I use this trick in my Calendar Seminar and Templates so that ANY form can call the Calendar popup.

Good question!
Richard Rost  @Reply  
          
6 years ago
Or to make THAT code even MORE flexible, you could say:

Docmd.OpenForm "ZipLookupF"
Forms!ZipLookupF!HiddenCallingFormName = Me.Name

And now you can just drop that code into ANY form without having to edit the form name.
Richard Rost  @Reply  
          
6 years ago
Basically, there are multiple ways to reference an open form in Access. I've generally taught:

Forms!CustomerF!FirstName

But this is also acceptable, and allows for programmability:

Forms("CustomerF")!FirstName
Ray White  @Reply  
      
6 years ago
Thanks Richard
I'll try that out.
Richard Rost  @Reply  
          
6 years ago
My pleasure.
Ray White  @Reply  
      
6 years ago
That works GREAT.. Thanks Richard
So now I can use my frmZipCodeSelector from any other form.
Just put the HiddenCallingFormName text box on the frmZipCodeSelector and have it hidden.

*********************************************************************
Then in the cmdSet button on the frmZipCodeSelector form:

Private Sub cmdSetZip_Click()
    Forms(HiddenCallingFormName)!City = City
    Forms(HiddenCallingFormName)!State = State
    DoCmd.Close acForm, "frmZipCodeSelector", acSaveYes
End Sub
*************************************************************

This will be in the form that calls the frmZipCodeSelector

Private Sub OpenZIPForm()
    DoCmd.OpenForm "frmZipCodeSelector", , , "ZipCode=""" & ZipCode
Richard Rost  @Reply  
          
6 years ago
You got it.

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

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: 7/17/2026 7:43:04 AM. PLT: 0s