Solved

Closing forms

Posted on 2009-07-07
5
348 Views
Last Modified: 2013-11-28
I have a form that, when I'm entering data, uses information from another form.

What I'd like to do is
1. Save the current record (easy enough: just close the form)
2. Close the OTHER form before closing the currently open one, but making sure that the information I'm am getting (e.g. a customer number) gets into the table.
3. Close the current form.

I've done a lot of searching, but I can't seem to find anything.

Thanks,

ep
0
Comment
Question by:ericpete
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Accepted Solution

by:
darbid73 earned 175 total points
ID: 24792263
Basically closing forms you will need these if you put it in this order then OtherForm will close first and then currently open will.

You have to decide where you put this - if you make a button for it or it is somehow otherwise triggered.


DoCmd.Close acForm, "OtherForm"
DoCmd.Close acForm, "CurrentlyOpen"
0
 
LVL 6

Assisted Solution

by:Yadtrt
Yadtrt earned 150 total points
ID: 24792545
To make sure that the value has been added to the current form use:

if not isnull(The Value) then
DoCmd.Close acForm, "OtherForm"
DoCmd.Close acForm, "CurrentlyOpen"
else
msgbox " No value has been added to the form")
end if
0
 
LVL 20

Expert Comment

by:darbid73
ID: 24792585
Yes you are going to have to fill in more details of what the user can do and when they can do it.  Yadtrt has for example added one possibility, which assumes that users must enter information in this textbox(or whatever control it is).

I assumed that these forms are bound and thus letting Access to all the saving work.
0
 
LVL 5

Assisted Solution

by:bboswell
bboswell earned 175 total points
ID: 24792649
Think about it differently. Why do you look at it that you need to close the Form first.

Do it in the following steps
1. Save the current record. (This will ensure you save the "other" form dependent data )
2. Close "other" form
3. Close Current Form

'Step 1 Save Current Record
DoCmd.RunCommand acCmdSaveRecord
'Step 2 Close other Form
DoCmd.Close acForm, "Other"
'Step 3 Close Current Form
DoCmd.Close acForm, "Current"
0
 
LVL 15

Author Comment

by:ericpete
ID: 24800043
Thanks.

I was mostly just not remembering the DoCmd.RunCommand part.

ep
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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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