Results 1 to 4 of 4
  1. #1
    isabelle2378 is offline Novice
    Windows 2K Access 2007
    Join Date
    Oct 2010
    Posts
    2

    How do I display SQL constraint errors?

    Hi,


    I am a SQL DBA and have not worked much with Access. I have an existing Access 2007 database that has linked tables to SQL 2005 tables. There is a constraint on a table to eliminate entering duplicate values but no error displays in the Access form when it is triggered.

    I confirmed that the constraint is working on the SQL side but when I go into the Access form and enter a duplicate value, it just disappears as if it was accepted but no value was entered into the SQL database.

    Thank you in advance.

    Isabelle

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That sounds odd because Access would normally report the error. Check the form's error event and make sure it isn't handling it that way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    isabelle2378 is offline Novice
    Windows 2K Access 2007
    Join Date
    Oct 2010
    Posts
    2
    Hi Paul,
    Thank u for your reply. When I go into the Design View on the button that takes me into the form, right click on the field and click on the event, this is what I see:

    Private Sub cmdfrmBarcode_Click()
    On Error GoTo Err_cmdfrmBarcode_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "frmPrtMgr_Barcodes"

    stLinkCriteria = "[ItemID]=" & Me![ItemID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_cmdfrmBarcode_Click:
    Exit Sub
    Err_cmdfrmBarcode_Click:
    MsgBox Err.Description
    Resume Exit_cmdfrmBarcode_Click

    If I click on the Button and it brings me to the 3 fields that I am trying to enter these duplicates into, I right click and show properties, there is nothing in the event tab.

    Thanks,
    Bea

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You are undoubtedly more knowledgeable than I on SQL Server (being self-taught, there are huge gaps in my knowledge). I would normally prevent duplicates by having the field in question be a/the key field. Is that how you're doing it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 10
    Last Post: 07-25-2011, 12:07 PM
  2. Accessing Table via asp Errors
    By KLynch0803 in forum Programming
    Replies: 1
    Last Post: 01-17-2010, 09:59 AM
  3. .ocx Files Errors
    By darshita in forum Import/Export Data
    Replies: 9
    Last Post: 12-07-2009, 07:36 AM
  4. On delete cascade fails in constraint clause
    By Victor EGBE in forum Queries
    Replies: 0
    Last Post: 03-02-2009, 09:52 PM
  5. dialog box errors in report
    By Jane in forum Programming
    Replies: 0
    Last Post: 11-20-2008, 01:06 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