[AccessD] Two problems A2003 vs A2010

Jim Dettman jimdettman at verizon.net
Fri Feb 24 09:29:47 CST 2012


Rocky,

  It's what I call a "timing" bug.

   Because "Access" is made up of multiple components (UI, JET, and VBA),
some operations occur in different threads of execution.  Where you see this
the most is with JET, which does a lot of things in the background while
"Access" proceeds with other tasks.  By default, JET uses three threads of
execution to perform background tasks.

  When moving to a slower/faster machine or changing the number of
background threads for JET, this type of thing will pop up because events
can occur in a different sequence or within an event, background tasks might
not occur fast enough.

  Populating of recordsets is one, instantiation of controls is another.

  If you mess with a control in the OnOpen event, it's hit or miss whether
it will exist or not when your line of code is  executed.  On some machines
it may work fine and on others not.

  Many developers do something with controls in OnOpen because it's
cancelable unlike OnLoad.  But OnLoad is the first point at which you can be
sure that every control has been created.

  One work around for that is to issue a Me.Repaint in the OnOpen, which
forces Access to pause until every control is created.  Then do your check
and cancel if need be.

  Not sure if anything like that exists for the recordset.  A Me.Refresh
might work.  But since you moved the code to OnLoad and there's no impact
with that, that is the best fix.

Jim.

  

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Friday, February 24, 2012 10:03 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Two problems A2003 vs A2010

Aha.  Well I'm going to move that code to the Load event on the other forms.
Oddly it's just in the forms for the purchasing module - the others seem to
work OK but haven't thoroughly tested.

Thanks

R

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
Sent: Friday, February 24, 2012 6:58 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Two problems A2003 vs A2010

Rocky,

  The code was in the wrong place to start with.  Your just lucky it worked
in 2003.

  In On Open, the form is just being opened and the forms record set may or
may not be fully populated at any point.

  You are not guaranteed that it's fully populated until the On Load event.

  You might have had the same problem with the 2003 version with just moving
to a faster/slower PC then what you developed with.

Jim. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Friday, February 24, 2012 09:28 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Two problems A2003 vs A2010

Dear List:
 
I have a simple line of code Docmd.GoToRecord , , acLast which works in
A2003 but in A2010 generates a run-time error '2046 - The command or Action
'GoToRecord' is not available now'.  The second problem is that the form
does not open maximized in 2010 but does on 2003.
 
I moved the maximize and gotorecord code to the Load event from the Open
event and it now appears to work.
 
Has anyone seen this?  IS this a known 'eccentricity' of 2010?  Any
guidelines on what  is OK in Open and what must be in Load in 2010?
 
MTIA
 
Rocky Smolin
Beach Access Software
858-259-4334
www.bchacc.com <http://www.bchacc.com/> www.e-z-mrp.com
<http://www.e-z-mrp.com/>
Skype: rocky.smolin
 
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list