Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: Special Error Traping

    I have a unique issue. I need to trap the error about primary key violations, but there is no error number...How do i trap that error?
    Jim

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    is there an err.description you could string-compare? izy

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Originally posted by izyrider
    is there an err.description you could string-compare? izy
    not sure how that works....its the error that says the records u tryied to insert didnt not work because of 1 blalbla 2 key violations 3 blah blah 4 blah blah

    are u familure witht hat error?
    and if so hwo do u do a err.discription string compare?
    Jim

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    forget yesterdays comment - i was caught up in my own .SendObject problem and wasn't thinking straight.


    does this do the job:
    Code:
    private sub myBox_BeforeUpdate(Cancel as integer)
       dim recs as DAO.recordset
       set recs = Me.Recordset
       recs.Findfirst "theFieldName = " & myBox.value
       if recs.NoMatch then
          exit sub
       else
          msgbox "Potential Error is trapped"
          Cancel = True
       endif
    end sub
    izy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •