Update automatically - Date Last Updated & ID

Z

zufie

1)How do I get my field, Date Last Updated, (Date/Time data type) to
update automatically on my form header, after a record has been added
or changed?
The date format is: MM/DD/YYYY.


2)How do I get my field, ID, (AutoNumber data type) to update
automatically on my form header, after a record has been added or
changed?

Both fields, Date Last Updated & ID, are contained in the table, Tbl
Main ID.

Thanks for your help!

I have already made many attempts without success!

John (Zufie)
 
M

MGFoster

zufie said:
1)How do I get my field, Date Last Updated, (Date/Time data type) to
update automatically on my form header, after a record has been added
or changed?
The date format is: MM/DD/YYYY.


2)How do I get my field, ID, (AutoNumber data type) to update
automatically on my form header, after a record has been added or
changed?

Both fields, Date Last Updated & ID, are contained in the table, Tbl
Main ID.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

1. You'll have to use the form's BeforeUpdate event procedure (VBA).
Like this (in the form's VBA module):

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me.[Date Last Updated] = Date()

End Sub

This will set the "Date Last Updated" to the current system date
("today").

2. If you have bound the control that holds the "ID" value, whenever
you enter the data into one of the form's controls the ID value should
appear in the ID's control. AutoNumbers are generated on the form's
BeforeInsert event (the first time you enter data) so the ID should be
showing in its control. Make sure you've bound the control to the
table's ID column (field). Look at the control's ControlSource
property, it should have ID in the field.

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

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

iQA/AwUBSoIvSIechKqOuFEgEQLxMgCgy/sXXdGLjhlEvgdPJ8mjC2n6N1MAoKjR
UuVu/zORdWQSfFkQ7SxJT2Ys
=fkQ1
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top