insert date table was appened

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I append a table using a qry, how can I insert todays date in the date
field?

using Access 2003
Thanks!
 
Troy said:
When I append a table using a qry, how can I insert todays date in the date
field?

If you always want the current date in the date column, if the user
forgets to put it there, you can add a Default property of =Date() to
the column in the table Design. That will work for new records (append
or INSERT INTO statements).
 
that didn't work, why? I have the default value set to short date too. I
noticed when I look at the table the date field is blank, but new record has
todays date.
grrr!
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The Default value can't be set to "short date" that is a formatting
designation.

Remember that the Default will only work on NEW records. Therefore, if
you want the Date() to be entered into any existing records, that don't
have a date in the required column, you'll have to run an UPDATE:

UPDATE table
SET date_column = Date()
WHERE date_column IS NULL

(Substitute your table/column names where appropriate.)

For changes (UPDATEs) to records thru forms you'll have to use the
form's BeforeUpdate event procedure to enter the Date():

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Not Me.NewRecord Then
If IsNull(Me!DateColumn) Then Me!DateColumn = Date()
End IF

End Sub
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmmaBoechKqOuFEgEQIi8QCgxD3cFLe0rU0paTC/OhMP//OwJuIAoOYV
xr1uhzBEMSdkiqmWe9c5E+L+
=SjDS
-----END PGP SIGNATURE-----
 
Back
Top