?
Solved

Switching between checkboxes problem

Posted on 2006-07-21
4
Medium Priority
?
157 Views
Last Modified: 2010-04-30
Hi experts,

I have two checkboxes on my form. When the first one is selected i wanna deselect the other one.
My code does that but only when I click second time on the first checkbox. Any ideas y?

Private Sub EmptyDate_AfterUpdate()
    If Me.EmptyDate.Value = 0 And Me.JustEmpty.Value = -1 Then
        Me.EmptyDate.Value = -1
        Me.JustEmpty.Value = 0
    End If
End Sub
0
Comment
Question by:Yury Merezhkov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17157978
If you only want one selected at any given time you should be using option buttons.

However -

Private Sub JustEmpty_Click()
    If JustEmpty.Value = vbChecked Then EmptyDate.Value = vbUnchecked
End Sub

Private Sub EmptyDate_Click()
    If EmptyDate.Value = vbChecked Then JustEmpty.Value = vbUnchecked
End Sub


If I read your question correctly.
0
 
LVL 7

Author Comment

by:Yury Merezhkov
ID: 17158003
Same thing, i have to click one checkbox twice to deselect the second one
0
 
LVL 9

Accepted Solution

by:
Rob_Jeffrey earned 375 total points
ID: 17158023
Are they being loaded with values on startup?  Such as both being checked when the form loads?
You will need to add code on the form load to ensure only one is checked.
0
 
LVL 7

Author Comment

by:Yury Merezhkov
ID: 17158257
They are both not checked when the form loads. Well, I guess I'll go with option boxes. Thanks, anyways.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question