Solved

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

Posted on 2013-01-16
2
238 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
[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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

737 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