Combo Box Enable Question!

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have a form that has a combo Box that has 2 options in Row source (Active
&
Finished)cbStatus, and another combo box that list clients, is possible to
lock The clients Combo Box cbOwnerID when it is in active mode (Enable No)
when in finished mode (Enable Yes)

Thanks in advance.........Bob Vance
 
Hi Bob,

of course...

in the code behind your form, create this:

'~~~~~~~~~~~~
Private Function LockClient()
dim mBoo as boolean
if nz(cbStatus, "Active") = "Active" then
mBoo = true
else
mBoo = false
endif
me.cbOwnerID.enabled = mBoo
End Function
'~~~~~~~~~~~~

on the AfterUpdate event of cbStatus -->
=LockClient()

on the form OnCurrent event -->
=LockClient()

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Or, even simpler,

Private Function LockClient()
Me.cbOwnerID.Enabled = (Nz(cbStatus, "Active") = "Active")
End Function
 
Do I put these codes behind cbOwnerID or On the Form, And where abouts do I
puy them once im there? Thanks For your Help...Bob
 
Hi Bob,

if you put the code behind the form, for some reason, the
builder button (...) can't find it -- but it works! It must
be a FUNCTION not a Sub

on the other hand, if you refer to a general function, the
builder button will take you there...

To get to the code behind the form, choose View, Code from
the menu while you are in the design view of your form

The reason I did not have you do [Event Prcedure] is because
you need the same code for more than one event

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Hi Bob,

look at my next post

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Do I put this code at the very end of the other codes?
And still cant find:
on the form OnCurrent event -->
=LockClient()

Regards Bob
 
Hi Bob,

the LockClient code needs to be behind your form

from the menu, when you are in the deign view of your form:

View, Code

You can also use the code that Doug gave you -- they both do
the same thing. Doug's code is more efficient, but I was
not sure how much you program, so mine is longer.

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Ok I put dougs code in code behind the form should I have to do anything
else, because i cant seem to get it to work...Thanks Bob
 
Back
Top