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


Trying to get a checkbox to be true if form opens for new record entry

Posted on 2014-07-16
Medium Priority
Last Modified: 2014-07-18
I'm trying to get a checkbox to be true if a form opens for a new record data entry.  Here's my code.  I've tried on onopen and onload and neither method checks the checkbox true.

    If Me.NewRecord = True Then
       Me.chkbxNewRecord = True
    End If
Question by:SteveL13
LVL 40

Accepted Solution

PatHartman earned 2000 total points
ID: 40199710
You need to put the code into the on Current event.  The Open and Load are "form" level events and run once for the form.  The Current event is a "record" level event and runs once for each record when you first move to it.
LVL 31

Expert Comment

by:Helen Feddema
ID: 40204772
It is best to use code like this, to guarantee that the checkbox will be unchecked for a record that is not a new record (also, use the bang (!) for members of collections, such as controls on a form):

Me![chkbxNewRecord].Value = Me.NewRecord

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

864 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