Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828
    Hi JojoWhite,
    I figured it out, lost some code in the process but put it back in and all works like a charm!
    Again,


    Thank you very much....
    Dave

  2. #17
    Join Date
    Sep 2025
    Location
    Newport, Shropshire, UK
    Posts
    16
    I dont want it to be able to duplicate the CatName if the CatTypeID is = the CatTypeID on my form. If CatTypeID is different, then I want it to add
    If I understand you correctly isn't the solution much simpler? Don't you simply need to include the CatName and CatTypeID columns in a single unique interest? If you then try to insert a row with values which are already present in another row in the table, the index will be violated and you can handle the error in the form's Error event procedure. Otherwise the values will be accepted.

    If you are not familiar with creating an index on multiple columns this is done by first selecting Indexes on the table Design ribbon. In the dialogue which opens enter a suitable name for the index in the first empty row of the Index name column, CatTypeCatName say. In the Field Name column of the same row enter CatTypeID, and with this row still selected, in the Index Properties below, select 'Yes' as the Unique property. Then enter CatName in the Field Name column in the row immediately beneath CatTypeID. Don't enter anything in the Index name column for this row.

    Having created the index, deliberately generate the error by entering two values you know to already exist in another row. The will enable you to identify the error number. In the Error event procedure, if the dataerr number equals that you've identified call the MsgBox function to inform the user and set the return value of the Response argument to acDataErrContinue.

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

Similar Threads

  1. Access Dlookup of a Dlookup Assistance
    By caper in forum Access
    Replies: 3
    Last Post: 08-27-2020, 05:56 PM
  2. Shortening if / dlookup >0 / then dlookup
    By Jack Russel in forum Modules
    Replies: 1
    Last Post: 02-19-2016, 03:01 PM
  3. Replies: 4
    Last Post: 05-31-2013, 07:00 PM
  4. Need help with dlookup.
    By Keith in forum Database Design
    Replies: 8
    Last Post: 05-24-2010, 06:28 PM
  5. Need Help for Dlookup function
    By wasim_sono in forum Programming
    Replies: 5
    Last Post: 01-04-2006, 08:18 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