Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Join Date
    Apr 2013
    Posts
    6
    First let me start by saying I apologize for the length of this email I have tried to take screenshots but am unable to send them through the forum. Therefore, I'm going to break this down on the flow both by design and need. This database fulfills several functions of my agency one being to track subpoenas issued to officers for court and another to track property disposal dispositions for evidence that was previously seized but no longer required.

    The table is named subpoenatable and without going into every field I have it structured as follows. The eventnumber is an auto number field followed by the officersname, TPDCase1, TPDCase2, TPDCase3, TPDcase4, TPDcase5, firstnotification, duedate, secondnotification, dispositioncompleted. I need the eventnumber auto number so I can create a dropdown lookup to find previous entries.

    This table then feeds two separate forms. The "subpoenaentryform" and "propertyroompropertydisposaltrack" form. When our officers receive subpoenas the information is entered into the subpoena entry form and notification is emailed to the officer when to attend court. The second form is used to track requests made to the officers asking they dispose of property that is no longer required as evidence.

    There are records created in the property disposal form that have nothing to do with subpoenas as not every piece of evidence seized is tied to a subpoena, sometimes officers take items but charges are not filed, the case is dismissed, or an item is lost and found and we need the disposition from an officer to dispose of it and therefore a subpoena was never entered.

    The decision was made to use one table to feed both forms as dispositions are needed for both court cases and non-court case incidents and we want to make request to the officers for a disposal within five days after their court date.

    The fields on the property disposal track form of importance are officer's name which is combo 172, a lookup field from our employees table and the five TPD case number fields. My hope is to create code should an officer's name be selected and a case number entered in any one of the five TPD case number fields that match a previous record in the subpoena table we are notified this is a duplicate entry and then cancels the event undoing any entered data leaving the form blank ready for the next entry.

    What we found because the system allowed duplicates the officers would turn in the completed forms and we would mark them as such however that indicator of complete was only on the one record leaving three or four others as incomplete therefore displayed in a report showing the pending requests as incomplete.

    Historically I have used the code below which I stole from the Internet to notify us of duplicates on an unrelated form and table when a duplicate case number is entered. However this current event I need to match on the name and any one of the five case numbers as the order the case numbers were entered into may not be the same as duplicate entries are accidentally made.

    I can provide photos or screenshots if you are willing to provide the mechanism for transfer. I have created a fine duplicates query but prefer not to manually hunt these things down for the rest of my career. Again I truly appreciate your help and hope this problem can be solved without having to restructure everything.
    Truly,

    Mark Grayson


    Code not related to this event but used to find duplicate case numbers when they are entered into another part of our system
    Private Sub CaseNumber_BeforeUpdate(Cancel As Integer)
    Dim answer As Variant
    answer = DLookup("[casenumber]", "recordsprocessing", "[casenumber] = '" & Me.Casenumber & "'")
    If Not isnull(answer) Then
    MsgBox "Duplicate Case Number Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
    Cancel = True
    Me.Casenumber.Undo
    DoCmd.Close
    DoCmd.OpenForm "recordsprocessingform", acNormal, , , acFormAdd
    End If
    End Sub



  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Are you saying the query you created works? How about a DLookup() on that query?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    Join Date
    Apr 2013
    Posts
    6
    Quote Originally Posted by pbaldy View Post
    Are you saying the query you created works? How about a DLookup() on that query?
    The statement below, which is just a copy and paste from my last post is not related to any of these tables or forms. I entered this statement into the form on the before update event. This would work as a before update if I could figure out how to apply this to something like dlookup combo172 and if combo 172 and tpdcase1 or combo172 and tpdcase2 or combo172 and tpdcase3 match then set the warning this is a duplicate entry. I figured how to apply this to dlookup on one field but not multiple match.

    Code not related to this event but used to find duplicate case numbers when they are entered into another part of our system
    Private Sub CaseNumber_BeforeUpdate(Cancel As Integer)
    Dim answer As Variant
    answer = DLookup("[casenumber]", "recordsprocessing", "[casenumber] = '" & Me.Casenumber & "'")
    If Not isnull(answer) Then
    MsgBox "Duplicate Case Number Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
    Cancel = True
    Me.Casenumber.Undo
    DoCmd.Close
    DoCmd.OpenForm "recordsprocessingform", acNormal, , , acFormAdd
    End If
    End Sub

  4. #19
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, I'm still catching up from being out of the country. Did you get this sorted? If both fields are text, multiple fields would look like:

    DLookup("[casenumber]", "recordsprocessing", "[casenumber] = '" & Me.Casenumber & "' And OtherField = '" & Me.OtherField & "'")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #20
    Join Date
    Apr 2013
    Posts
    6
    Quote Originally Posted by pbaldy View Post
    Sorry, I'm still catching up from being out of the country. Did you get this sorted? If both fields are text, multiple fields would look like:

    DLookup("[casenumber]", "recordsprocessing", "[casenumber] = '" & Me.Casenumber & "' And OtherField = '" & Me.OtherField & "'")
    I have not resolved this, I truly appreciate your response. I will try this tomorrow and update the forum if this works at some point others may stumble upon this as a potential answer as I have done many times from others. Thank you and I will let you know soon.

  6. #21
    Join Date
    Apr 2013
    Posts
    6
    Quote Originally Posted by Mark Grayson View Post
    I have not resolved this, I truly appreciate your response. I will try this tomorrow and update the forum if this works at some point others may stumble upon this as a potential answer as I have done many times from others. Thank you and I will let you know soon.
    could you put this in the context of combo172 and tpdcase1 or combo172 and tpdcase2 or combo172 and tpdcase3 or combo172 and tpdcase4 or combo172 and tpdcase5. The table is called "SubpoenaTable" and the form is "PropertyRoomPropertyDisposalTrack" if I can get that format right I think the rest will fall into place. Learning without application means nothing thank you so much for the help

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Prevent Saving of Form
    By bburton in forum Access
    Replies: 4
    Last Post: 02-25-2011, 09:26 PM
  2. Replies: 2
    Last Post: 02-12-2011, 09:54 PM
  3. Prevent a form from closing
    By ksmithson in forum Forms
    Replies: 0
    Last Post: 07-15-2010, 12:49 PM
  4. Prevent Multiple bookings
    By Rory898 in forum Forms
    Replies: 2
    Last Post: 02-05-2010, 11:59 AM
  5. Prevent Duplicate Values on Combination of Two Fields
    By LornaM in forum Database Design
    Replies: 8
    Last Post: 05-05-2009, 11:16 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