[AccessD] Two problems A2003 vs A2010

Rocky Smolin rockysmolin at bchacc.com
Fri Feb 24 18:23:37 CST 2012


Well, it turns out that moving the code from the _Open event to the Load
event did not take care of the problem of the form not Maximizing and
centering itself on the screen.

Anyone got any ideas why?

Again, it's an A2K3 mdb (I did convert it to accdb to try it native A2K10
but no cigar).  I'm using the AHD form resizing code.  And end the code in
the Load module with a DoCmd.Maximize.

MTIA

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Friday, February 24, 2012 2:11 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Two problems A2003 vs A2010

Thanks Jim - Major Help! 

Dan
:-)

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

Dan,

 Yes, put Me.repaint at the top of your OnOpen.  Every control reference
after that will always be valid.
 
<<Do you have any additional steps on resolving the problems associated with
timing issues?>>

  No other then moving code.  Timing issues are always a result of doing
something where you should not be doing it in the first place.

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

Jim,

My system collects most errors.  Some of them are like 'can't find control'.
As if I could solve that.

Sounds like if I put Me.Paint in the open event of every form I might avoid
some of those.

Do you have any additional steps on resolving the problems associated with
timing issues?

Thanks!
Dan

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

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

--
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

--
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