Solved

Check Box - For smart ppl

Posted on 2000-04-04
5
141 Views
Last Modified: 2010-05-18
I have a problem. I am new to VB and was hoping if any of you could help me out.

I've created a several check boxes but once my click on the box it carries out my procedure. I would like to reverse his procedure to how it was before i clicked on it.

How can i do this ???

Below is a sample of a coding. Ignore the actual structure.

Within the checkbox click command>>>

Image1.visibility = true
Image2.visibilty = false


When clicked>>>Image1 shows and image 2 disappears.

I would like to reverse the process when i click again.

I would appreciate any help !!!

thank you
0
Comment
Question by:m0ley
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
riduce earned 50 total points
Comment Utility
Here is you're answer

Private Sub Check1_Click()
If check1.value = 0 then image1.visible = false: image2.visible = true
if check1.value = 1 then image1.visible = true : image2.visible = false
End Sub
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
Private Sub Form_Load()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not (Check1.Value = vbChecked)
End Sub

Private Sub Check1_Click()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not (Check1.Value = vbChecked)
End Sub
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
A little improvement:

Private Sub Form_Load()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not Image1.Visible
End Sub

Private Sub Check1_Click()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not Image1.Visible
End Sub
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
Even better:

Private Sub Form_Load()
    Check1_Click
End Sub

Private Sub Check1_Click()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not Image1.Visible
End Sub
0
 

Author Comment

by:m0ley
Comment Utility
Cheers mate

It worked like a charm !!! :-)

Much appreciated and thank you once again
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now