My Assistant
![]() ![]() |
|
|
Apr 26 2008, 06:22 PM
Post
#1
|
|
|
UtterAccess Member Posts: 34 |
From a parent form, you click a button that generates a new form in a new window. Here is the logic that needs to happen:
1. Form opens, grab some details about the child from the parent window to display. 2. As a user works, the record and child records save as usual. 3. At some point the user will click save which will add an actual account number to the page. 4. If the user navigates away from the page (closes the form, goes to another record) and there is no account number, ask the user if they want to save or discard their record. Saving populates the account number and discarding cleans up the record by deleting children and then the record itself. I had this working fine when I was just dealing with one record. On form unload event I would check to see if the number was populated and then populate it or delete records based on their choice. Then we started testing the moving from record to record and that event didn't work. In fact I still can't find an event that works. Some events are firing when the form opens initially. If I had a LeaveRecord & EnterRecord event, I could do this all super easy. I know this is just a case of me not understanding the naming for the events or how Access is trying to do things for me that I can't let it do (or I have to let it do and then undo or redo myself). Everytime I think I have it 100% locked down, the event I'm expecting to fire doesn't fire or two events fire at once in an unexpected way and I get a message asking me to save on opening a record instead of leaving a record. |
|
|
|
Apr 26 2008, 06:36 PM
Post
#2
|
|
|
Utterly Yorkshire and Forum/Wiki Editor Posts: 15,880 From: Devon UK |
The event that fires when navigating records is the On Current event, so you'd need to do your checks there as well as the forms Unload event..........
|
|
|
|
Apr 28 2008, 03:24 AM
Post
#3
|
|
|
UtterAccess Member Posts: 34 |
Thanks. yeah Current is "RecordEntered". It fires after you navigate to a new record, not before you leave your current record.
To have logic that fires before you navigate it looks like the only event is really "BeforeUpdate", which isn't a very good event for what I'm doing. I need something to fire prior to leaving a record. BeforeUpdate could (and often does) fire multiple times while you're on the record. If you a subform, it fires each time you have a dirty record and change form focus. Also it won't fire if you nav away and your record isn't dirty. I saw this here: http://www.tek-tips.com/viewthread.cfm?qid...1191&page=7 This pretty much confirms the thought I had that I might have to create my own navigation because MS didn't think people would need to know when navigation happens. If I'm missing something I'd love to learn that knowledge, but it seems that this is something that the form events don't fully support. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 12:49 PM |