Combo Box Enable Question!

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
 
S

strive4peace

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

*
 
D

Douglas J Steele

Or, even simpler,

Private Function LockClient()
Me.cbOwnerID.Enabled = (Nz(cbStatus, "Active") = "Active")
End Function
 
B

Bob

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
 
S

strive4peace

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

*
 
S

strive4peace

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

*
 
B

Bob

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
 
S

strive4peace

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

*
 
B

Bob

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top