unique entry

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #16
    I'm going to try the same thing in one of my forms and see if I can duplicate the error.

    Comment

    • didacticone
      Contributor
      • Oct 2008
      • 266

      #17
      ok...i appreciate all of your help man...

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #18
        Well I didn't get any errors when I tried, but at the same time, it didn't work at all!

        Here's how I did get it to work. You can put some code in the AfterUpdate Event of the textbox.

        Private Sub TicketNumtxt_Af terUpdate()
        if DCount("CURYear ","Master","CUR Year = """ & [Yeartxt] _
        & """ AND TicketNum = """ & [TicketNumtxt] & """") > 0 then
        'there is already at least 1 same entry
        msgbox "That Ticket Number is already used."
        TicketNumtxt = ""
        TicketNumtxt.Se tFocus
        Else
        'it's ok
        End If

        The only problem I had with this is, it doesn't set the cursor back in the field after it clears it for some reason.

        Comment

        • didacticone
          Contributor
          • Oct 2008
          • 266

          #19
          it works perfectly... thanks a ton for all your help man... greatly appreciated

          Comment

          Working...