[AccessD] Access 2010 VBA Editor

William Benson (VBACreations.Com) vbacreations at gmail.com
Tue May 10 01:32:47 CDT 2011


My code traditionally includes loops like

For each ctrl in Controls
   If TypeOf Ctrl is Access.CommandButton then
        If Ctrl.Caption like "ButtonsOnRightOfForm*" then
             Set Btn = Ctrl
             'Do something based on the .Left property of the Button

But frequently I take a shortcut and just use

   If TypeOf Ctrl is Access.CommandButton then
        If Ctrl.Caption like "ButtonsOnRightOfForm*" then
             'Do something based on the .Left property of Ctrl

Anyway, my question about the VBE still hangs out there if you or another
has an answer... it is a different behavior between 2010 and 2003 unless it
involves an Option in the VBE which I do not know about.

Thank you.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Tuesday, May 10, 2011 12:39 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Access 2010 VBA Editor

Why are you trying to write code using a property that doesn't apply to the
generic object?  If you wait until you set the control object to a
particular kind of control that has a Top property, your code will work.

Charlotte Foust

On Mon, May 9, 2011 at 3:40 PM, William Benson (VBACreations.Com)
<vbacreations at gmail.com> wrote:
> I have been asked to upgrade a database which I wrote a lot of code 
> for in Access 2003, to Access 2010. I thought this ought to be "no 
> problem." Well, it kinda is.
>
> One thing I am running into is that when I declare Ctrl as a Control 
> write code such as
>
> Ctrl.Top      (there is no "Top" property associated with every single
> Control) Access 2010 VBA is now very unhelpfully writing 
> Ctrl.TopPadding the moment I type a space after the letter "p". I went 
> back to 2003 VBA and the VBE does not do that in the prior version.
>
> Is this a setting that can be banished?
>
> --
> 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