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 / Reports / Printing / August 2007

Tip: Looking for answers? Try searching our database.

Capturing date/time modified on a form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Monique - 28 Aug 2007 03:30 GMT
I have a form where staff can go and add student information, I would like to
be able to capture when and if the form has been modified.  We are running
reports on students with certain behaviours right now but we don't know how
up-to-date the data is if we don't capture if it's been changed recently.

I added TimeModified and DateModified to my main table and put the fields on
my form that I need it to capture but I'm not sure how to actually get it to
fill those fields once data has been modified, any help would be appreciated.

Monique
Duane Hookom - 28 Aug 2007 05:46 GMT
This question would be more appropriate in the Forms Coding NG however, you
could add code to the Before Update event of your form to set
Me.txtDateModified = Date
Me.txtTimeModidfied = TimeValue(Now())
Signature

Duane Hookom
Microsoft Access MVP

> I have a form where staff can go and add student information, I would like to
> be able to capture when and if the form has been modified.  We are running
[quoted text clipped - 6 lines]
>
> Monique
Monique - 29 Aug 2007 01:00 GMT
Well I've added as I said the DateModified and TimeModified field to my main
students table, put those 2 fields on my form, then I go into the design
section of the form, right click on the date modified box, click on the event
tab and then I put in the code you just wrote Me.txtDateModified = Date.  I
then closed the form and saved it, went back in and modified a students
details in the form and it didn't put the date in there?  Any clues.

Monique

> This question would be more appropriate in the Forms Coding NG however, you
> could add code to the Before Update event of your form to set
[quoted text clipped - 11 lines]
> >
> > Monique
Duane Hookom - 29 Aug 2007 01:18 GMT
The code should have been "added to the Before Update event of your form". I
don't know where you entered your code.

Did you change the code to match your text box names or change the text box
names to match the code?

Signature

Duane Hookom
Microsoft Access MVP

> Well I've added as I said the DateModified and TimeModified field to my main
> students table, put those 2 fields on my form, then I go into the design
[quoted text clipped - 20 lines]
> > >
> > > Monique
Monique - 29 Aug 2007 01:42 GMT
Duane

OK, what I've done now is this, go into the form design, right click on the
date field then the event tab, now I've clicked on the little tab that took
me to visual basic, I put the code down like this:

Private Sub DateModified_BeforeUpdate(Cancel As Integer)
DateModified = Date

End Sub

So my field is just called DataModified but it is not doing anything.

Monique

> The code should have been "added to the Before Update event of your form". I
> don't know where you entered your code.
[quoted text clipped - 26 lines]
> > > >
> > > > Monique
Duane Hookom - 29 Aug 2007 01:50 GMT
Again, the code should have been "added to the Before Update event of your
form". There shouldn't be any code in the update of the DateModified.
Signature

Duane Hookom
Microsoft Access MVP

> Duane
>
[quoted text clipped - 41 lines]
> > > > >
> > > > > Monique
Monique - 29 Aug 2007 02:22 GMT
Can you please explain how to do that, I just can't work it out.

> Again, the code should have been "added to the Before Update event of your
> form". There shouldn't be any code in the update of the DateModified.
[quoted text clipped - 44 lines]
> > > > > >
> > > > > > Monique
Duane Hookom - 29 Aug 2007 02:54 GMT
Open your form in design view and display the properties dialog. Find your
form properties and then click the Event tab. Find the Before Update event
property and click the builder button on the right. Choose to enter some code
and then enter the code that I suggested. You will need to make sure the code
matches your control names.

Signature

Duane Hookom
Microsoft Access MVP

> Can you please explain how to do that, I just can't work it out.
>
[quoted text clipped - 46 lines]
> > > > > > >
> > > > > > > Monique
Monique - 29 Aug 2007 04:54 GMT
OK, I went straight to the main form in design view, clicked on the
properties icon and went to event tab, before update was not on the list, it
only shows if I actually click on the field properties of my DateModified
field, then when I click on the code builder it takes me to visual basic and
that's where I added the DateModified = Date as you suggested.

If I go back to the form view and change something it doesn't update that
field with the current date, if I click in that field and type anything it
comes back saying wrong data and autofills it with the current date but that
is only from me actually trying to enter data into that field.

Monique

> Open your form in design view and display the properties dialog. Find your
> form properties and then click the Event tab. Find the Before Update event
[quoted text clipped - 52 lines]
> > > > > > > >
> > > > > > > > Monique
Duane Hookom - 29 Aug 2007 05:22 GMT
When I view the Form properties (the word "Form" is in the title bar of the
property dialog) there are over 50 event properties (Access 2003). The fourth
event property in the dialog is "Before Update". This event property has been
there as long as I can remember.

Signature

Duane Hookom
Microsoft Access MVP

> OK, I went straight to the main form in design view, clicked on the
> properties icon and went to event tab, before update was not on the list, it
[quoted text clipped - 65 lines]
> > > > > > > > >
> > > > > > > > > Monique
Monique - 30 Aug 2007 04:10 GMT
I can see the before update event when I click on properties.  I'll explain
to you exactly how I get there:

*  Open DB
*  Go to Forms section of the objects
*  Double click on the "Students" form (which is the form I want to add the
date to)
*  Click on properties icon, now what I notice when I click on that icon is
it automatically goes to the first field "UniqueID" so it's showing me the
properties for that field.  If instead of clicking on the properties icon in
the design view I can change the field to detail, I see the before update
even and go to the code builder and put in =[DateModified]=[«Expr»]=[Date]
but it doesn't work.

I'm just not sure what I'm doing wrong, I can see the field you are talking
about in the properties but it's not saving it there or it's only saving it
to a specific field.

Monique

> When I view the Form properties (the word "Form" is in the title bar of the
> property dialog) there are over 50 event properties (Access 2003). The fourth
[quoted text clipped - 70 lines]
> > > > > > > > > >
> > > > > > > > > > Monique
Duane Hookom - 30 Aug 2007 05:08 GMT
Did you ever see the word "Form" in the properties dialog as I stated it
should? If not, click on the little rectangle to the left of the horizontal
ruler and above the vertical ruler. This should then display the FORM
properties, not the properties of a control or section.

Once you have this, you need to find the Before Update event and click the
builder. Go to the code window and enter the code that I suggested.

If have no idea how you came up with
"code builder and put in =[DateModified]=[«Expr»]=[Date]"
This looks like something from the Expression Builder, not any kind of
code/module window.

Signature

Duane Hookom
Microsoft Access MVP

> I can see the before update event when I click on properties.  I'll explain
> to you exactly how I get there:
[quoted text clipped - 90 lines]
> > > > > > > > > > >
> > > > > > > > > > > Monique
Monique - 31 Aug 2007 01:04 GMT
OK

I didn't know how to find that, now I know, it was only giving me the detail
section so when I clicked on that little rectangle thing that took me to the
form properties.  Your right I was doing it in expression builder not code
builder, when I did that it worked!  Yay thanks so much, should I go and do
the same with the time now?

Monique

> Did you ever see the word "Form" in the properties dialog as I stated it
> should? If not, click on the little rectangle to the left of the horizontal
[quoted text clipped - 103 lines]
> > > > > > > > > > > >
> > > > > > > > > > > > Monique
Duane Hookom - 31 Aug 2007 02:54 GMT
You have my permission to set the time with the Time( :- ).
Signature

Duane Hookom
Microsoft Access MVP

> OK
>
[quoted text clipped - 113 lines]
> > > > > > > > > > > > >
> > > > > > > > > > > > > Monique
 
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.