Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Closing forms

Posted on 2009-07-07
5
Medium Priority
?
355 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:Eric AKA Netminder
[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 700 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 600 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 700 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:Eric AKA Netminder
ID: 24800043
Thanks.

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

ep
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

721 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