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 / November 2007

Tip: Looking for answers? Try searching our database.

Date changing in a Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dplove - 01 Nov 2007 20:38 GMT
I'm not that famaliar iwth creating expressions so if someone can please help
me with this problem I would greatly appreciate.

I have a form that has "Status" field.  When I change the status to
"Terminated" I would like for "today's date" to populate in that field and
also in the "Last status change date" field.  Also when I change the status
to "Shipped" I would like for "today's date" to populate in the "Shipped
Date" field and the "Last Status change date" field.  

How can I accomplish this task?
Douglas J. Steele - 01 Nov 2007 20:51 GMT
Put code into the field's AfterUpdate event to set those fields.

Something like:

Private Sub Status_AfterUpdate()

 If Me.Status = "Terminated" Or Me.Status = "Shipped" Then
   Me.[today's date] = Date()
   Me.[Last status change date] = Date()
 End If

End Sub

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> I'm not that famaliar iwth creating expressions so if someone can please
> help
[quoted text clipped - 8 lines]
>
> How can I accomplish this task?
Klatuu - 01 Nov 2007 20:55 GMT
You can use the After Update event of the status control to do this.  You
post says you want "that field" to be populated with the current date.  What
field is "that field"? It can't be the status field.

Basically you would use something like this:

Private Sub Status_AfterUpdate()
   If Me.Status = "Terminated" Then
       Me.[Last status change date] = Date
   ElseIf Me.Status = "Shipped" Then
       Me.[Last status change date] = Date
       Me.[Ship Date] = Date
   End If        
Signature

Dave Hargis, Microsoft Access MVP

> I'm not that famaliar iwth creating expressions so if someone can please help
> me with this problem I would greatly appreciate.
[quoted text clipped - 6 lines]
>
> How can I accomplish this task?
dplove - 02 Nov 2007 14:04 GMT
This works prefect.  Another question:
I have another form called Purchase Orders and in this form there is a
subform that is the "Assets" table.  In the Assets table there is also the
same fields below (Status, Last status change date, shipped date and
terminated date).  If the user uses this form (Assets) to change the status I
want the dates to populate and it is not doing it.  How can I put this same
expression in the table or in the subform in order for it to work?

> You can use the After Update event of the status control to do this.  You
> post says you want "that field" to be populated with the current date.  What
[quoted text clipped - 20 lines]
> >
> > How can I accomplish this task?
 
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.