Saturday 15 May 2010

Access Database table with multiple overlapping schedule -


I have access database tables with many overlapping schedules, I thought it was something to me to face with overlapping existing time limits. It makes it easy to make it easy. If a user approves a program for an employee when the user approves the next program overlapping for the same employee when the user approves the overlapping schedule and is removed, then I need to create a warning message . The text from the table does not contain much information about the VB code or if there is something that I can set in the query. Any help would be appreciated

OK, I have a table with 3 fields. EmpID, StartTime, & amp; Last Time. Start & amp; Date and amp; in the end time

Then I have a form with the same 3 fields.

Before you are already struggling in any way, I canceled the property and displayed a message. The code has been there:

  Private SUB form_BeforeUpdate (canceled as integer) Dim RS records set Dim strSQL string slow EmpID as Long-Term ScheduleStart String String Dimension Schedule as string form As in EmpID = Me.txtEmpID ScheduleStart = My .txtStartTime ScheduleId = MeteTandTead Time SRSQLLL = "" Strosulk = StrokesQL & amp; "SELECT Count (schedule.EmpID) AS Conflict" & amp; VbCrLf strSQL = strSQL & amp; "From schedule" & amp; VbCrLf strSQL = strSQL & amp; "Where (((Schedule.EmpID) = @EmpID)" & vbCrLf strSQL = strSQL & amp; "and ((# @ ScheduleStart #) & lt; = [StartTime])" & amp; vbCrLf strSQL = strSQL & "And" ((# @ Schedulind #) & gt; [start time]) "& amp; VbCrLf strSQL = strSQL & amp;" or (((Schedule.EmpID) = @EmpID) "& vbCrLf strSQL = StrSQL & amp; "and ((# @ ScheduleStart #) & lt; = [ENDTIME])" & amp; vbCrLf strSQL = strSQL & amp; "and ((# @ ScheduleEnd #)> [ENDTIME])) StrSQL = Replace (strSQL, "@EmpID", EmpID) strSQL = Change (strSQL, "@ScheduleStart", ScheduleStart) strSQL = Change (strSQL, "@ScheduleEnd", Schedulind) debug. Print SRSQL Set RS = Current DB OpenResourceSet (SRSQL) if RS ("conflict")> again = True MsgBox "found the contradiction", vbExclamation, "the contradiction found" means the last cancel, end sub   

it looks for 2 scenarios, both use EmpID.

  • Schedule Schedule Start and Schedule >> Start Time
  • or Schedule Start & Lt; End time and ScheduleInd & gt; End-time

    Most of the code is building SQL If a parameter query was used, it would be very clear, but I did it because I thought it was clear.

    Debug. Print SRSQL will show you how your building looks.

    There is no error checking in it, so you have to put something. Right now, when you enter dates, it has to appear: 6/26/13 4:31 pm

No comments:

Post a Comment