Solved

Event AFTER Domain Functions Have Resolved

Posted on 2011-02-23
8
382 Views
Last Modified: 2013-11-28
I've added some DLookups to a form and they're wreaking havoc on some of my objects in memory (collections being destroyed, etc.) that are created On_Load.  If I initialize all these objects AFTER the DLookups have resolved there should be no problem.  I've tested this by running the code with a button after I see the DLookup values populated.  Is there a form event that fires when all these functions have resolved?  OnLoad and OnCurrent run before they have resolved.

Mike
0
Comment
Question by:shacho
8 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 166 total points
ID: 34966986
from access help, type   responding to events

look at Order of events for database objects

hope this help for whatever you are trying to do
0
 
LVL 75
ID: 34967104
Where exactly are these DLookups() ?
What event occurs after they run depends on where they are executing.
DLookups() within themselves are not going to do anything to any other code.

mx
0
 

Author Comment

by:shacho
ID: 34967141
>Where exactly are these DLookups() ?
As Control Sources on unbound textboxes.

>DLookups() within themselves are not going to do anything to any other code.
You're right - they shouldn't.  But something goes haywire when they resolve.  You may recall I was working on storing references to textboxes in a collection in order to monitor double-click events.  As soon at I put these DLookups on my form, the collection vanishes from memory after one double-click event is trapped.  Poof - it suddenly equals "Nothing".  If I remove the DLookups, everything works fine.  The DLookups themselves also resolve just fine.  I've already worked around it by running the DLookups once on Load in the code and setting the textbox values directly, i.e. there are no "live" DLookups on the form.  Now things are fine again.  Would love to know why, though.

Mike

0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 167 total points
ID: 34967156
I just downloaded that db ... will check it out in a bit ...

Technically ... DLookups() in a Control Source are then calculated values ... causing the Form to do automatic ReCalcs I suppose ... in case that matters.

mx
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 167 total points
ID: 34970175
I don't think there IS an Event you can trap that will do this, at least not reliably. Can you modify your approach such that you use Recordsets and such in the Form's Current event to load those unbound controls? Or perhaps a Class that can manage this, and then expose the values through Properties?

If you do something like that, you have full control over what is occurring, and can react to the logic/data processing exactly when needed.
0
 

Accepted Solution

by:
shacho earned 0 total points
ID: 34970288
>Can you modify your approach
Yes - I've already worked around the problem with a similar approach to what you've suggested.  It's a lot cleaner and faster anyway.  I would still love to know why DLookups cause this funky unstable behavior.  Just 'cause I'm curious.  I spend a decent amount of time coding around unexpected behavior in Access on any given complex project.  Some peripheral knowledge of what causes these sorts of problems makes it that much easier to troubleshoot or avoid in the first place.  I'm sure you can relate.

Mike
0
 
LVL 75
ID: 34972402
"I'm sure you can relate."
Yes.
0
 

Author Closing Comment

by:shacho
ID: 35042375
Just a mysterious bug.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

776 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