[AccessD] Can't Disable Control

Rocky Smolin rockysmolin at bchacc.com
Mon Mar 15 23:34:44 CDT 2010


I figured it out.  Well, I didn't actually figure it out.  Just kept trying
different things until I got the behavior I wanted.  (Kind of like raising
kids)
Set the focus to a control on the sub-form instead of the main form.  I
think the control where the code was barfing might have been the first in
the tab order?
Anyway, problem solved - not figured out - but solved.

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Monday, March 15, 2010 6:45 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Can't Disable Control

Where are you running the code?  In an event procedure for a control?
What has control has got the focus when the code starts?

Looks as though cboCTNID is the active control on the subform. Try setting
focus to something else on the subform.


-- 
Stuart

On 15 Mar 2010 at 17:44, Rocky Smolin wrote:

> Dear List:
> 
> In the following code:
> 
>     Me.subfrmFormulaBOM!fldFormulaBOMSequence.Enabled = False
>     Me.cmdExit.SetFocus
>     Me.subfrmFormulaBOM!cboCTNID.Enabled = False
>     Me.subfrmFormulaBOM!fldCTNPricePerPound.Enabled = False
>     Me.subfrmFormulaBOM!fldFormulaBOMQuantity.Enabled = False
>     Me.subfrmFormulaBOM!cmd100.Enabled = False
> 
> 
> when it tries to execute     Me.subfrmFormulaBOM!cboCTNID.Enabled = False
I
> get an error 2164 - you can't disable a control while it has the focus.  I
> stuck that Me.cmdExit.SetFocus in there right before the line just to make
> sure the focus was elsewhere but I get it anyway.
> 
> I'm thinking this is one of those error messages that doesn't really mean
> what it says but I don't know.
> 
> Any guesses?
> 
> BTW cboCTNID is a bound control like the others - bound to a field in the
> record source.
> 
> MTIA
> 
>  
> 
> Rocky Smolin
> 
> Beach Access Software
> 
> 858-259-4334
> 
> www.e-z-mrp.com <http://www.e-z-mrp.com/> 
> 
> www.bchacc.com <http://www.bchacc.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