Results 1 to 6 of 6
  1. #1
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117

    Question Alert on Existing Date Period

    dear,


    i need to create alert which should tell me about existing date period.

    ex: 01-01-12 to 12-01-12 if i enter now in this year any record even if it start from last date 12-01-12 or end at 01-01-12 or exist in same period one alert should come before save the record. how can i do?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Not clear what you want to compare.

    What data is in table - two fields with begin and end dates for period?

    What is entered by user - a single date value into a textbox?

    Code in textbox BeforeUpdate event. Maybe something like:

    If Not IsNull(DLookup("fieldname", "tablename", "#" & Me.textboxDate & "# BETWEEN fieldnameStart AND fieldnameEnd"))
    MsgBox "Period exists. Record save canceled."
    Cancel = True
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117
    very very thanks on reply,
    yes june7 these are two fields one start date and second end date between this period even one day exist it should tell me and don't save it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Did the code work?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117
    yes fine it works but it active on those records where i need to edit only it should active on only new record.
    what should i do for edition.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    The code will run whenever value in the textbox is edited. However, can adjust the code to do the search for only new record.

    If Me.NewRecord Then
    ...

    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-04-2012, 05:22 PM
  2. Replies: 11
    Last Post: 05-23-2012, 08:42 AM
  3. Replies: 5
    Last Post: 01-27-2012, 04:47 PM
  4. How can i know existing period
    By waqas in forum Forms
    Replies: 1
    Last Post: 09-19-2011, 11:36 AM
  5. Getting Tax Period from current date
    By crxftw in forum Forms
    Replies: 3
    Last Post: 07-09-2011, 07:12 AM

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