[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is there an event that can detect when a user exits from adding a new record without adding it?

Posted on 2011-05-13
12
Medium Priority
?
292 Views
Last Modified: 2012-05-11
I have a form that I use to display customer records and a subform (continuous records) to display associated asset records. I would like the sub form to not display a blank record so I have set AllowAdditions to No. I have added button to add a record that sets AllowAdditions to True. That part works fine but when the user exits that record, either after adding it or not, what I want is to set AllowAdditions to False again. What event(s) would I use to do that? Or is there a better way?
0
Comment
Question by:Rob4077
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 20

Expert Comment

by:clarkscott
ID: 35753285
On the form, in the AFTERUPDATE event - set your allowadditions = false

Scott C
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 35753328
Afterupdate won't work if the blank record has not transitioned to a dirty state (i.e. not attempt to add a value in any field).

if the user moves to a previous record, allowadditions will still be true!
0
 

Author Comment

by:Rob4077
ID: 35753336
That half works. If I add a new record it works but if I decide to escape and cancel out of the process by clicking on an existing record the AllowAdditions remains set to true. Do I have to live with that or is there a way around it?
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 20

Expert Comment

by:clarkscott
ID: 35753379
It seems the AfterUpdate won't fire unless the record IS in a dirty state???  Perhaps afterinsert would work.
Scott C
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 35753384
Maybe ONCurrent. - try it.
Scott C
0
 

Author Comment

by:Rob4077
ID: 35753432
I've tried them but they're not reliable so I think I will just stick to leaving allowadditions to true and train the operators to interpret the form.

Thanks for your very kind assistance.
0
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 35753486
<<What event(s) would I use to do that? Or is there a better way? >>

  You'd need two check in two places:

1. The Lostfocus event of the subform control on the main form.
2. The OnCurrent event of the subform.

  The first covers them moving out of the subform.  The second covers them moving into another record within the subform.

JimD.
0
 

Author Comment

by:Rob4077
ID: 35753548
Thanks Jim. I tried that and it looks like it did the trick. Are you still the moderator for this page? I need to get the question re-opened and the points awarded to you.
0
 
LVL 58
ID: 35753718
<<Thanks Jim. I tried that and it looks like it did the trick. Are you still the moderator for this page? I need to get the question re-opened and the points awarded to you. >>

 Don't worry about the points...glad to hear it worked for you.

 And yes, I'm still a zone advisor.

JimD.
0
 

Author Comment

by:Rob4077
ID: 35753749
Jim, I am happy to award all the points to you since you have provided the correct answer. I will leave it to you if you want to fix it. It may be worth it for the sake of the next person who researches this question.
0
 

Author Closing Comment

by:Rob4077
ID: 35759719
Thanks for providing a working solution.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month18 days, 13 hours left to enroll

834 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