Solved

Close the form from a subform procedure

Posted on 2012-03-22
7
369 Views
Last Modified: 2012-03-22
I have a mainform/subform.  On teh subform next to the record is an edit button that does call another form for a particular record and works find. But I want to close this first form in the code, but since it is on the sub-form, it does not close the entire form at all.

 DoCmd.OpenForm "frmEmployees", , , "[EmpUserID]= '" & strUserID & "' " -THIS WORKS
 DoCmd.Close acForm, Me.Parent.frmEmpsNoJobID - THIS DOES NOT

The main form is called frmUnmatchedEmpoyees.  This is an Access 2003 form.

Sandra
0
Comment
Question by:ssmith94015
  • 3
  • 2
  • 2
7 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37754864
it is not clear from your post what objects are open and when....

It is also not clear what form you are on and what form you want to close

(Or even why you would want to close a form that you are not currently in/on...?

You say things like "I want to close this first form"
...but it is not clear what form you have designated as the "First form"

This is why a sample database is *Much* easier to work from than a complex description...

Or instead refer to your forms as FormA, FormB, FormC, ...etc
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37754873
Just use the name of the form.

Docmd.close acform, me.parent.name
0
 

Author Closing Comment

by:ssmith94015
ID: 37754882
That did it.  I had assumed when the sames said Name, I shoudl type the name of the subform!

Sandra
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 61

Expert Comment

by:mbizup
ID: 37754883
Alteratvely

Docmd.close acform,"frmunmatchedemployee"
0
 

Author Comment

by:ssmith94015
ID: 37754899
Jeff, part of the reason I don't post the databases is that I am at a finanicial institutions and every thing is confidential with a lot of client data, transaction, account numbers etc.  When I encounter a problem during the day, I simply cannot clean out the database in order to post it, but need to try to describe the problem as best I can without loading any data.  It is a bit cumbersome, but is the environment I have to work with.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37754918
Very smart!  I wish everybody who posted here were that conscientious.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37755654
<Jeff, part of the reason I don't post the databases is that...>

I understand, ...just in a lot of cases I find that the issue can quickly be resolved by the simple saying I always use...
    "Just show me what you have, ...then show me what you want..."  

;-)

Jeff
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question