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 / June 2008

Tip: Looking for answers? Try searching our database.

Date Entry Validation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
junior00 - 30 Jun 2008 20:43 GMT
Hello.
I have a form/sub form into which I enter times (start and end) for a given
process.
User selects the process in the main form, and the sub form contains the
fields into which the start time and end time are entered.

There can be several entries per process.  I have been able to enter in
validation so that end time is greater than start time - no problem.  What I
would like to do is further add validation - not only is end time greater
than start time, but when user proceeds with a new entry for a process the
subsequent start time must be after the previous end time.

Any help would be much appreciated.

Thanks,
GZ
Klatuu - 30 Jun 2008 20:55 GMT
You can use the Form AfterUpdate event of the record to populate a module
level date variable with the value of the end time.  Then in your Form
BeforeUpdate event or Start Time control BeforeUpdate, you can compare the
current start time with the the saved value in the module level variable.

The only trick is there will nothing to compare for the very first record,
so you have to allow for that in your coding.
This would be an example in the control's Before Update event:

   If Not IsNull(dtmLastEndTime) Then
       If dtmLastEndTime > MetxtStartTime Then
           MsgBox "Start Time Must be After " & dtmLastEndTime
           Cancel = True
       End If
   End If

Signature

Dave Hargis, Microsoft Access MVP

> Hello.
> I have a form/sub form into which I enter times (start and end) for a given
[quoted text clipped - 12 lines]
> Thanks,
> GZ
 
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.