Solved

When I clear a check box, my code still works, how do I fix this in acccess?

Posted on 2013-01-16
2
234 Views
Last Modified: 2013-01-17
Here is my simple code for a check box:

Private Sub Check165_Click()
'DoCmd.OpenForm "frmExceptions", , , [ResourceID] = "& Me.ResourceID"

DoCmd.OpenForm "frmExceptions", acNormal, , , acFormAdd, acWindowNormal
[Forms]![frmExceptions]![ResourceID] = [Forms]![frmEditResources]![ResourceID]

End Sub

I want to be able to uncheck a box also in order to remove the "exception", and not have the form open.  What is the best way to accomplish this?
0
Comment
Question by:gracie1972
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38784973
Try this:


Private Sub Check165_Click()

If Me.Check165 = false then Exit Sub

'DoCmd.OpenForm "frmExceptions", , , [ResourceID] = "& Me.ResourceID"

DoCmd.OpenForm "frmExceptions", acNormal, , , acFormAdd, acWindowNormal
[Forms]![frmExceptions]![ResourceID] = [Forms]![frmEditResources]![ResourceID]

End Sub

Open in new window

0
 

Author Comment

by:gracie1972
ID: 38787974
Thank you, I was so close when I was trying different codes :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

863 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

24 Experts available now in Live!

Get 1:1 Help Now