Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MS Access 2003 and 2007 Add a checkbox then automatically update the date field with the current date

Posted on 2008-11-04
6
Medium Priority
?
1,045 Views
Last Modified: 2013-11-28
Need to know how to add a checkbox, and when the check box is checked, insert current date into the date
field box.  How do I do the statement in the expression builder?
0
Comment
Question by:friskee
  • 3
  • 3
6 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 800 total points
ID: 22883552
Add a checkbox to the from
Then use code like this to insert the date:

Sub YourCheckBox_AfterUpdate()
    If me.YourCheckBox=True then
        me.YourDate=Date()
    end if
End sub

You will, of course, have to modify this and add your specific data entry validation rules.

JeffCoachman
0
 

Author Comment

by:friskee
ID: 22884240
It's not working- here's the code:
Sub ChkSold_AfterUpdate()
If Me.ChkSold = True Then
        Me.txtSoldDate = Date
    End If
End Sub

txtSoldDate control source is the sale date field in my sale table
txtSoldDate is the name
What else could I be doing wrong?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22889098
This is fairly standard code.
I can't see a reason why it might not work.

Please Post a sample of this database.

JeffCoachman
0
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.

 

Author Comment

by:friskee
ID: 22900736
I tried it again.  IT WORKS-  thank you that answer was straight forward and simple.  increased points
come back and answer me anytime-
0
 

Author Closing Comment

by:friskee
ID: 31513348
Simple fast response- Wonderful!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22901489
;-)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give 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