Combo box enable/disable

janith

CPA
Local time
Today, 21:30
Joined
Apr 11, 2012
Messages
65
Hi

Glad to be on this forum. Can some help me... I've 2 combo box on my form , 1)status 2)refer reason. What i want is when the form loads the refer combo should be disabled and it should only be enabled when i select the value "refer to tl" from the status combo box, any help thanks....As I am new to this forum this mode of creating thread was suggested to me by sparks80.. thank him very much:)
 
Hi,
Do you know how to disable the refer combo box?
Does " Refer to tl" in Combo box "Status" have a unique autonumber?
 
Hi,

I hadn't appreciated you were looking for a specific value. Here is the code you need for the afterupdate event if you need the status combobox value to be "refer to tl".

Code:
Private Sub StatusComboboxName_AfterUpdate()
    Me!ReferComboboxName.Enabled = Me!StatusComboboxName.Value Like "refer to tl"
End Sub
 
Hi i am still not able to make it work , i am attaching the file can you please chk what is missing?
 

Attachments

Hi Janeth,
I downloaded your file. It works.
The code provided by Sparks80 is correct.
What is the issue?
 
r u saying that refer to combo box is disabled when the form is loaded and only becomes enabled when the value "refer to tl" is selected from status combo box? If its working at your end .. i will surely try it on access 2003 as well...
 
Hi,

I have checked your example database and the refer reason combobox is disabled when "refer to tl" is selected in the status combobox.

However I have realised this will only work for the current record. So that the enabled property is set correctly when you change record you will need to use the Form_Current event too. I have also changed the code to handle when the status combobox value is null.

Code:
Private Sub Form_Current()
    Me.refer.Enabled = Nz(Me.status.Value, vbNullString) Like "refer to tl"
End Sub

Private Sub status_afterUpdate()
    Me.refer.Enabled = Nz(Me.status.Value, vbNullString) Like "refer to tl"
End Sub

Does this fix the problem?
 
yes I am saying exactly that.
It also changes back to unabled if you reselect another value like diarized
 
sparks80, can you please make changes to my file and send it to me. as on my system i still feel this is not working... sorry for the trouble...
 
Hi,

Here is the modified file, it works fine on my computer which runs Access 2007.
 

Attachments

Users who are viewing this thread

Back
Top Bottom