Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

810 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