Results 1 to 7 of 7
  1. #1
    mann2x is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    10

    another conflict problem..

    i have two text boxes which are intended for time-in and time-out..what i need next is to check if the next time-in input is in between the previous time-in and time-out inputs and if it is then a conflict warning will appear..can this be done?please help me out..

  2. #2
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    1. You need a field that you can later use for identifying what the "previous" row is.
    2. You need knowledge in VBA, looping, and DAO recordset.

  3. #3
    mann2x is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    10
    Quote Originally Posted by evander View Post
    1. You need a field that you can later use for identifying what the "previous" row is.
    2. You need knowledge in VBA, looping, and DAO recordset.
    can you give me a sample?

  4. #4
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    You could do it with DLookup assuming you have something like an employee ID, name, etc... in the data source:

    If DLookup("[EmpID]", "[tblTimesheets]", "(#" & [Forms]![frmTimeEntry]![txtInTime] & "# Between [tblTimesheets].[InTime] AND [tblTimesheets].[OutTime]) AND [tblTimesheets].[EmpID]=" & Chr(34) & [Forms]![frmTimeEntry]![txtEmpID] & Chr(34)) Then
    'Output error message
    End If
    The table and field names are obviously made up so remember to insert your own. It takes the Employee identifier from the form, and searches the table where the times are recorded for a matching ID. If any of the records match the ID it checks to see if the new time is between the related In and Out times. If it finds a match it flags it for your error handling otherwise it ignores the entry.

    I would probably use the code in the [txtTimeIn] Lost Focus event or when pushing a button to add the record but it can be used a lot of different ways.
    Last edited by slave138; 10-14-2010 at 11:50 PM. Reason: Changed formatting to quote for easier reading

  5. #5
    mann2x is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    10
    gee thx dude!!thx a lot!!

  6. #6
    mann2x is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    10
    i forgot to tell you that a conflict will occur if these conditions are met:
    allTimeIn < newTimeIn > allTimeOut And newDay = allDay
    sheesh..helllllllllppppppp!

  7. #7
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    I'm not sure I follow...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Write Conflict Demonstration
    By pkstormy in forum Code Repository
    Replies: 1
    Last Post: 12-02-2010, 08:25 PM
  2. Schedule Conflict Coding
    By mann2x in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 09:52 AM
  3. Query Conflict
    By isnpms in forum Queries
    Replies: 3
    Last Post: 08-21-2010, 12:01 PM
  4. 2 combo boxes - Conflict
    By JimS in forum Forms
    Replies: 3
    Last Post: 10-13-2009, 03:49 PM
  5. Write Conflict Error
    By botts121 in forum Access
    Replies: 5
    Last Post: 09-25-2009, 12:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums