Solved

Closing forms

Posted on 2009-07-07
5
329 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
5 Comments
 
LVL 19

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 19

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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 …

785 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