Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

date function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerald - 27 Nov 2005 12:29 GMT
I have a field with a function Date(), which updates everyday for the same
record

how can I have a Date() which will ofcourse does populate the current date
in the date field but in addition to this, it should not change or update ,
next day or onwards

plz help.

Manythanks
Allen Browne - 27 Nov 2005 12:53 GMT
If I understand correctly, you have a text box whose Control Source is set
to:
       =Date()
so that it always shows today's date.

If you wanted to record the date when a record was first entered:
1. Open your table in design view.
2. Add a new Date/Time field named (say) EnteredOn
3. In the lower pane of table design, set its Default Value property to:
       =Date()

If you want to record the date when the record was last changed:
1. In table design, add another Date/Time field named (say) UpdatedOn.
2. Open the form where you alter the data in design view.
3. Set the BeforeUpdate event of the *form* to:
       [Event Procedure]
4. Click the Build button beside the property.
   Access opens the code window.
5. Set up the code like this:
   Private Sub Form_BeforeUpdate(Cancel As Integer)
       Me.[UpdatedOn] = Date()
   End Sub

Note: If you want to record the time as well as the date, use =Now() instead
of =Date().

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a field with a function Date(), which updates everyday for the same
> record
[quoted text clipped - 3 lines]
> ,
> next day or onwards
Gerald - 28 Nov 2005 06:36 GMT
Thanks for your input, did work on the solution

Now I have 3 date field in one table
date field 1 is Date()
date field 2 has Me.[UpdatedOn] = Date()
date field 3 has Me.[UpdatedOn] = Date()

if system date changes the date field 2 and 3 changes, can I not have it
fixed , i.e.
date field 2 entered is 28/11/05
tomo. I changed date field 3 to 29/11/05, so I need date field 2 to be
28/11/05
and date field 3 to be 29/11/05. i.e. can be updated only once

p.s. I have each date field in 3 different tab page in one tab control

Hope its clear

Thanks

> If I understand correctly, you have a text box whose Control Source is set
> to:
[quoted text clipped - 29 lines]
> > ,
> > next day or onwards
Allen Browne - 28 Nov 2005 08:01 GMT
These 3 suggestions have different purposes:

1. Always today:
If you always want today's date to show in a text box, you do not need a
field for it. Just bind the text box to:
   =Date()
Now you don't have to update the field every day.

2. Creation date:
Use the Default Value of the field in the table. This does not change when
the record is later updated.

3. Modification date:
Use the BeforeUpdate event procedure of the form. This does change when the
record is later updated.

You can have mulitple text boxes on different pages of your tab control that
show the contents of the same field.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Thanks for your input, did work on the solution
>
[quoted text clipped - 54 lines]
>> > ,
>> > next day or onwards
Gerald - 28 Nov 2005 08:12 GMT
thanks,

If I have 1 tab control and 3 tab pages, can I have 1 form in each tab strip

wondering if its possible

> These 3 suggestions have different purposes:
>
[quoted text clipped - 73 lines]
> >> > ,
> >> > next day or onwards
Allen Browne - 28 Nov 2005 08:18 GMT
You can place a subform in each page of the tab control.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> thanks,
>
> If I have 1 tab control and 3 tab pages, can I have 1 form in each tab
> strip
>
> wondering if its possible
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.