User changes mind after AfterUpdate

  • Thread starter dougal via AccessMonster.com
  • Start date
D

dougal via AccessMonster.com

Hello,

I have a problem with my AfterUpdate on a combo box.

My combo box has three choices and on chosing only one of those choices 2
tick boxes become enabled. My problem lies when the user makes his choice
from the combo box, the tick boxes become active and are ticked but if the
user changes his mind and choses a different selection from the combo box,
the tick boxes become disabled but remain ticked. What do I have to do to
stop this from happening?

Any help much appreciated!
 
T

Tom Lake

dougal via AccessMonster.com said:
Hello,

I have a problem with my AfterUpdate on a combo box.

My combo box has three choices and on chosing only one of those choices 2
tick boxes become enabled. My problem lies when the user makes his choice
from the combo box, the tick boxes become active and are ticked but if the
user changes his mind and choses a different selection from the combo box,
the tick boxes become disabled but remain ticked. What do I have to do to
stop this from happening?

Any help much appreciated!

In the AfterUpdate event, do you set the tick boxes to true based on the
combo box choice? If so, explicitly set the others to False.

Private Sub Combo0_AfterUpdate()
Select Case Combo0
Case "Set Tick 1"
Me!Tick1 = True
Me!Tick2 = False
Me!Tick3 = False
Case "Set Tick 2"
Me!Tick1 = False
Me!Tick2 = True
Me!Tick3 = False
Case "Set Tick 3"
Me!Tick1 = False
Me!Tick2 = False
Me!Tick3 = True
Case Else
End Select

End Sub

Tom Lake
 
D

dougal via AccessMonster.com

I think perhaps I'm missing something here but will attempt to explain more
clearly what I mean. My combo box has three options - "Yes", "No" and "Don't
Know". When "Don't Know" is selected two tick boxes become active using
AfterUpdate. The user then ticks the boxes. If the user then goes back to the
combo box and selects "Yes" or "No" the tick boxes become inactive but the
ticks remain in them and are recorded in the table.

Apologies if that's what you meant below, I'm a real novice at this stuff.

Tom said:
[quoted text clipped - 8 lines]
Any help much appreciated!

In the AfterUpdate event, do you set the tick boxes to true based on the
combo box choice? If so, explicitly set the others to False.

Private Sub Combo0_AfterUpdate()
Select Case Combo0
Case "Set Tick 1"
Me!Tick1 = True
Me!Tick2 = False
Me!Tick3 = False
Case "Set Tick 2"
Me!Tick1 = False
Me!Tick2 = True
Me!Tick3 = False
Case "Set Tick 3"
Me!Tick1 = False
Me!Tick2 = False
Me!Tick3 = True
Case Else
End Select

End Sub

Tom Lake
 
K

Klatuu

Post your existing code in the After Update event and we can show you how to
modify it to clear the check boxes.
--
Dave Hargis, Microsoft Access MVP


dougal via AccessMonster.com said:
I think perhaps I'm missing something here but will attempt to explain more
clearly what I mean. My combo box has three options - "Yes", "No" and "Don't
Know". When "Don't Know" is selected two tick boxes become active using
AfterUpdate. The user then ticks the boxes. If the user then goes back to the
combo box and selects "Yes" or "No" the tick boxes become inactive but the
ticks remain in them and are recorded in the table.

Apologies if that's what you meant below, I'm a real novice at this stuff.

Tom said:
[quoted text clipped - 8 lines]
Any help much appreciated!

In the AfterUpdate event, do you set the tick boxes to true based on the
combo box choice? If so, explicitly set the others to False.

Private Sub Combo0_AfterUpdate()
Select Case Combo0
Case "Set Tick 1"
Me!Tick1 = True
Me!Tick2 = False
Me!Tick3 = False
Case "Set Tick 2"
Me!Tick1 = False
Me!Tick2 = True
Me!Tick3 = False
Case "Set Tick 3"
Me!Tick1 = False
Me!Tick2 = False
Me!Tick3 = True
Case Else
End Select

End Sub

Tom Lake
 
T

Tom Lake

dougal via AccessMonster.com said:
I think perhaps I'm missing something here but will attempt to explain more
clearly what I mean. My combo box has three options - "Yes", "No" and "Don't
Know". When "Don't Know" is selected two tick boxes become active using
AfterUpdate. The user then ticks the boxes. If the user then goes back to the
combo box and selects "Yes" or "No" the tick boxes become inactive but the
ticks remain in them and are recorded in the table.

Apologies if that's what you meant below, I'm a real novice at this stuff.

Okay, try this:

Private Sub Combo0_AfterUpdate()
Select Case Combo0
Case "Don't Know"
Me!Tick1.Active = True
Me!Tick2.Active = True
Me!Tick1 = False
Me!Tick2 = False
Case "Yes", "No"
Me!Tick1 = False
Me!Tick2 = False
Me!Tick1.Active = False
Me!Tick2.Active = False
Case Else
End Select

End Sub
 
K

Klatuu

I think you meant Enabled rathter than Active
There is no Active property for controls in Access.
 
T

Tom Lake

Klatuu said:
I think you meant Enabled rathter than Active
There is no Active property for controls in Access.
--

Yup, so I did. Thanks for the correction!

Tom Lake
 
J

Jeanette Cunningham

dougal,
in the code on the after update event, at the start of the code add a line
to enable all the check boxes

Private sub ComboName_AfterUpdate()
Me.chk1.Enabled = True
Me.chk2.Enabled = True
Me.chk3.Enabled = True
'put your current code for the after update event here
End Sub

Note - replace chk1, chk2 and chk3 with the names of your check boxes.


Jeanette Cunningham -- Melbourne Victoria Australia
 
J

Jeanette Cunningham

To all,
please disregard my last post - got a bit carried with the helping others
bit.


Jeanette Cunningham -- Melbourne Victoria Australia
 
D

dougal via AccessMonster.com

Hi All,

Many thanks for all your help, I've now got it working after many hours of
tearing my hair out!

D.

Jeanette said:
To all,
please disregard my last post - got a bit carried with the helping others
bit.

Jeanette Cunningham -- Melbourne Victoria Australia
[quoted text clipped - 8 lines]
Any help much appreciated!
 

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