Greyed out controls staying greyed when not applicable

G

Guest

Hi

The value of a combo box (cboSourceOpp) makes some following controls
invalid. I grey out the invalid controls as follows:

If Me!cboSourceOpp = "Other" Then
Me!OtherNotes.Enabled = True
Me!ContactNotes.Enabled = False
Me!cboOrganisationName.Enabled = False

ElseIf Me!cboSourceOpp = "Contact" Then
Me!OtherNotes.Enabled = False
Me!ContactNotes.Enabled = True
Me!cboOrganisationName.Enabled = True

ElseIf Me!cboSourceOpp = "Networking" Then
Me!OtherNotes.Enabled = False
Me!ContactNotes.Enabled = False
Me!cboOrganisationName.Enabled = False

ElseIf Me!cboSourceOpp = "Formal Tender" Then
Me!OtherNotes.Enabled = False
Me!ContactNotes.Enabled = False
Me!cboOrganisationName.Enabled = False

End If

This works while entering data, but there is a problem when browsing through
records. It seems that the enabled true / false setting for whichever record
was last accessed remains for all of them - so, a record with an entry in
SourceOpp of 'Other' will enable 'othernotes' while the data is being
entered, if I go back to look at that record later, 'othernotes' may be
greyed out. What am I doing wrong? Can anyone help?

thanks
 
G

Guest

You can either set this code on the OnCurrent event of the form, or better,
call the AfterUpdate event of the Combo (where I assume this code is located
in) in the OnCurrent event of the form

Call ComboName_AfterUpdate()

That way you need to maintain the code in only one place.
 
G

Guest

Thank you so much - I used Call ComboName_AfterUpdate() in the OnCurrent
event and that works fine.

Jenny
 

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