Enable Text Box Based On Combo Value List (1 Viewer)

Paul Cooke

Registered User.
Local time
Today, 05:21
Joined
Oct 12, 2001
Messages
288
Hi guys,

could someone point me in the right direction please as I can't seem to work this out !

I have a Combo Box "cboNumber" that contains a value list "1";"2";"3"

I have an event set up on the AfterUpdate to check what number is chosen from the value list

Code:
Private Sub cboNumber_AfterUpdate()
    If Me.cboNumber = "2" Then
    Me.NumberOther.Enabled = True
Else
    Me.NumberOther.Enabled = False

End If

What is supposed to happen is that if a user selects 2 from the combo box the text control "NumberOther" becomes enabled and the user can input data.

What is actually happening is that the NumberOther control IS enabling If I select "2" but #Name? keeps coming up in it and I can't seem to enter any data

I'm lost where to look next to work out what is going wrong - any ideas??

Many thanks
 

CBrighton

Surfing while working...
Local time
Today, 05:21
Joined
Nov 9, 2010
Messages
1,012
It sounds like the control source of the text box has problems, does it work correctly if it's set to enabled by default?
 

DCrake

Remembered
Local time
Today, 05:21
Joined
Jun 8, 2005
Messages
8,632
That sounds like you have a control source that Access can't find. Does the bound field exist?
 

Paul Cooke

Registered User.
Local time
Today, 05:21
Joined
Oct 12, 2001
Messages
288
Thanks for the replies..

Yes it still does the same if I after I have enabled it by default (Data Properties - Enabled = Yes)

The bound filed does exsist in the table but It was a field I added to the table after creating the form - not sure if that could cause a problem?

The ControlSource of the combo is correct (same values as the table) as is the rowsource, the rowsource type is Value List.

The controlsource of the text box is NumberOther and set as plain text...

Not sure if this helps in working out what gonning wrong or not???

Many thanks
 

boblarson

Smeghead
Local time
Yesterday, 21:21
Joined
Jan 12, 2001
Messages
32,059
FYI:

If you add a field to a table AFTER creating the form and if the form's recordsource is set to a query calling out individual fields, instead of a query with the asterisk (meaning select all from the table) or the table itself, then you have to add that field to the query that is in the recordsource or else it won't be available.
 

Paul Cooke

Registered User.
Local time
Today, 05:21
Joined
Oct 12, 2001
Messages
288
Many thanks all for the replies - I created a "testform" and re did the controls and it works now

Thanks for the info Bob - i was wndering if that is what was causing the problem but now I know it was and why !

Thanks again
 

Users who are viewing this thread

Top Bottom