Solved

Event AFTER Domain Functions Have Resolved

Posted on 2011-02-23
8
385 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
[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
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

734 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