[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

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

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
gracie1972
Asked:
gracie1972
1 Solution
 
mbizupCommented:
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
 
gracie1972Author Commented:
Thank you, I was so close when I was trying different codes :-)
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now