?
Solved

Save button on pop-up form

Posted on 2011-03-25
5
Medium Priority
?
417 Views
Last Modified: 2012-05-11
Hi!  I've got a Microsoft Acces form with a drop-down list providing customer names so I've added edit and new buttons to open the customers form to allow users to add/edit customer here, after which they hit the exit button to return to the main form, I then refresh the customers combobox on the lost focus event for the new/edit buttons, that is all great.  Now...

The customer has come into the habit of adding Save buttons to all their forms and have requested I do the same to keep the same format.  So the exit button is disabled until you hit the save button, which then does the usual "DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70" to save the record.

So the problem I've got is since I've added the Save button to the customers form, when they hit Save, Access tries not only to save the current record on the Customers form but also on the form behind it, which won't be complete at this stage and they get error messages about required fields not being complete.

So is there a way of getting the save button to only save the record on the form in focus?

As I've this typed now I've realised I can just remove that code and let Access do it's saving on exit anyway but it's a bit of a fudge.  Any other ideas?

Thanks!
0
Comment
Question by:ebooyens
[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
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 1200 total points
ID: 35218674
in the Save button on the popup, get rid of docmd and try:

Private Sub cmd_Save_Click

    me.Dirty = False

End Sub
0
 
LVL 16

Assisted Solution

by:Sheils
Sheils earned 800 total points
ID: 35218718
<As I've this typed now I've realised I can just remove that code and let Access do it's saving on exit anyway but it's a bit of a fudge.  Any other ideas?>

That's basically what I was  going to suggest. But you can go a little bit further and use the save button to update the combobox query so that if the user click the dropdown again they will see the new entry in the list.

You can do this with

Me.Dirty=false
Me.comboxName.requery

0
 
LVL 4

Author Comment

by:ebooyens
ID: 35221032
Ok thanks both, what does me.dirty = false do exactly?
0
 
LVL 16

Assisted Solution

by:Sheils
Sheils earned 800 total points
ID: 35221048
It saves the new record
0
 
LVL 4

Author Comment

by:ebooyens
ID: 35222623
Thanks for the help
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

719 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