Solved

Insert Default Date/Time Value into a Database Table

Posted on 2015-02-05
3
268 Views
Last Modified: 2015-02-05
Hello Experts

I wondered if there is an easy way of inserting one Date/Time value to all of my records in a database table.  Here is a summary of the situation.  I have been assigned a Membership Directory that is in excel format.  I have already imported the data into an access database table and made some changes.  We realized that we wanted to keep track of the dates that new members joined.  Therefore, we created a date time field that we will update going forward.  The question is, can we input one date (say 01/01/2015) into all of the current records, which is approximately 5,000 strong?

Thanks...
0
Comment
Question by:idejjedi2
[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
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40592362
yes, use an update query

Update TableName
Set [DateFieldName]=#1/1/2015#

now to automatically record date everytime a new member is added,
in the design view of the table
set the default value of the field to Date()
0
 

Author Closing Comment

by:idejjedi2
ID: 40592436
Rey - That was awesome - thank you.  As a follow up - only if easy.  If you wanted to do the same thing to a "Yes/No" data type??
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40592443
Update TableName
 Set [YesNoFieldName]=-1

-1 for true
0 for false
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

627 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