Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2004
    Posts
    156

    Unanswered: Exiting a Record in Access 2000 format

    Hey guys and gals:

    Situation: I have a form that is used to add new records. On this form, also, is a subform to show all records from a query. I have two fields indexed as a multi-field index: date and employee because there can only be one employee per date entered in this case.

    Problem: If the user is modifying the "new" record to be added and it happens to disobey the unique setting of the multi-field index, when they click on one of the records in the subform (essentially exiting the new record) Access throws up a big fat error saying, "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries, and try again." Help says this is error 3022.

    Question: Is this a problem that has been addressed in Access 2002 files with the RecordExit event? I cannot pinpoint an exact event that will let me capture this error and display my own message instead of this rather-confusing-to-an-end-user error.

    I'd appreciate the help! Thanks!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  2. #2
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    If you made/make a command button to open a form to add new, the error routine is already created for you. Goto the event on click for the command button created.

  3. #3
    Join Date
    Jul 2004
    Posts
    156
    No, it's nothing like that. This is referring to changing between two records--from a new one to an old one.
    DocX

    The teachings of God's Begotten: 2 John 1:9

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    there's a dirty little trick using the Form_Error() event.

    i don't use it myself, but it might help. see here for an example remarkably similar to your situation.

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Jul 2004
    Posts
    156
    izy

    You're the greatest, man. You are a fountain of Access/VBA knowledge! And I'm sure you are of a lot of other things, as well. And it's not wasted knowledge because you're willing to share it with people. Cheers!

    Just where did you find that link to that PERFECT example? I mean, the only difference was the error was a tad different. Thanks again!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    glad it helped

    Form_Error() has been on my list of curious things to play with for many years... your question triggered looking up the details on the net. most books i've seen don't offer much discussion on this event.

    this event is not much use to me 'cos i'm in unbound forms, but at least i can cross it off my list now.

    izy
    currently using SS 2008R2

  7. #7
    Join Date
    Jul 2004
    Posts
    156
    That's a new one on me...at least a new idea that I hadn't thought of before. I did not realize that you could work with records using unbound forms. But, since I'm not too well versed in record-handling with ADO or DAO, it's been easier to stick to bound forms. Maybe someday. :-) Do you know of any FAQs or tutorials on using unbound forms? It'd fix a LOT of my problems. Thanks!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i'm ashamed to say that my A-bible is Alison Balter's "Mastering Access 95" ...still going strong after eight years, still not sucked dry of useful info, still answering most of my questions or at least giving decent hints of what to search for on the net!

    i guess that any book discussing A-frontend and SQLserving-backend should have a decent discussion of unbound forms.


    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    wonders never cease! i just discovered that Alison is on the net here.

    izy
    currently using SS 2008R2

  10. #10
    Join Date
    Jul 2004
    Posts
    156
    That's great! An entire book online, although it is Access 95, is very handy. Free is always a good price.
    DocX

    The teachings of God's Begotten: 2 John 1:9

Posting Permissions

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