Max Wanadoo
max.wanadoo at gmail.com
Mon Mar 15 21:20:43 CDT 2010
My guess would be that your sub form is firing as soon as you set focus
on the main form.
Could you try to find another "out of the way" control on the sub form to
set focus on - an example might be:
Me.subfrmFormulaBOD!cmdExit.Enabled = true ' make sure you can focus on
it.
Me.subfrmFormulaBOD!cmdExit.SetFocus
Me.subfrmFormulaBOM!fldFormulaBOMSequence.Enabled = False
Me.subfrmFormulaBOM!cboCTNID.Enabled = False
Me.subfrmFormulaBOM!fldCTNPricePerPound.Enabled = False
Me.subfrmFormulaBOM!fldFormulaBOMQuantity.Enabled = False
Me.subfrmFormulaBOM!cmd100.Enabled = False
Max
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Tuesday, March 16, 2010 12:44 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Can't Disable Control
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/>