Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2006
    Posts
    30

    Exclamation Unanswered: HELP! Access error messages appear incorrectly!

    Hi Everyone,

    I have a really weird problem which is driving me mad! I'm hoping someone here might know the answer.
    I created a database application in Access 2000. Some of tables contain required fields which are not primary keys.
    When i created the front end application for this database (with Access Forms & VBA) I would get the normal error message when i would miss out data for a required field & tried to save it. The message was as follows:
    'The field <field Name> cannot contain a null value because the required property for this field is set to true. Enter a value in this field'

    All the required fields in my DB application had a similar msg when values were not entered for them. This is the auto msg that Access creates from the database table field values (i assume).
    This worked fine but then the specific msg stopped appearing for each required field. Instead i got the Generic
    'You Can't go to specified record' message.
    I am not sure what i changed for this to happen. I thought that the 'You Can't go to specified record' msg was an EOF or BOF msg but somehow it has replaced all the record operations error msgs that can occur on my front end forms.
    I know how to create a work around which captures the errors and allows me to create a custom error message but i want to go back to my original specific auto created message that specifies the field name and the reason for the error.

    Does anyone know how i managed to replace the original message with the 'You Can't go to specified record' message?
    Does anyone know how to go back to the original error msg type?

    Any help or suggestioons would be much appreciated. And than you in advance.

    Regards,

    Shuja.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    The first question that comes to mind is whether or not you have a recently backed up copy of your db! If not, I'm assuming you realize the error of your ways! This is simply a must-do! At least every hour of development time, more often if you're making major changes.

    Having said that,
    I am not sure what i changed for this to happen
    and
    Does anyone know how i managed to replace the original message
    isn't likely to get you any help. We simply have no way to know what you've done. Unless this is a bug someone else has run into before, and I doubt this to be the case, I would think there's really little anyone can offer to help you, based on what you've reported. My only suggestion would be, on the off chance that this is a corruption problem, to create a blank database and import all of your objects into the new db. If this runs OK, delete the original db and name the new one after the old one!

    Good Luck!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Sep 2006
    Posts
    30

    Exclamation RE:HELP! Access error messages appear incorrectly!

    Thanks Missinglinq,

    I do keep backups of the work i do but even in the earliest version this error msg replacement occurs. I am certain that the original msg did appear when i used the application previously.
    The original msg still appears when i leave a required field blank & try to go into the design mode of the form, but if i use the navigation buttons within the form then the new 'Can't go to specified record' error msg occurs.
    The only thing i can think of that i changed at the time was some of the links between the tables (to do with the required fields.
    But i don't see how this would have affected my previous backups.
    I've even tried to run the application on another pc but it gives the same result.

    I'm hoping this is possibly a setting of some sorts and that someone might know how to return it to it's original state.

    Hope this helps a bit more.

    Regards,

    Shuja

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Are these navigation buttons the native ones that Access places on the form or are you using custom buttons with DoCmd.GotoRecord code behind them?
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Sep 2006
    Posts
    30

    HELP! Access error messages appear incorrectly!

    They are custom buttons with the DoCmd.***** .
    Shuja.

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    That's what I thought! I've never seen the Can't go to specified record message with the native nav buttons, only the custom ones (which is what I use.) The cause of your problem, I think, is the manner in which Access processes things. With the custom buttons the first things processed are those within the the sub that holds the code behind your button, and this includes the error handler for that sub, i.e.

    Code:
    Err_Command11_Click:
    MsgBox Err.Description 'This send message Can't go to specified record 
    Resume Exit_Command11_Click
    The reason an error is being thrown, and the message box is popping up is you can't go to any other record until the current record is saved, and you can't do that until the required field(s) are filled in.

    A way around this would be to turn off Access' warnings and write your own error handling routine.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    Sep 2006
    Posts
    30

    HELP! Access error messages appear incorrectly

    Hi,

    MissingLinq, your spot on, mate! It is the custom button which cause this problem. I created a new test db with both native & custom buttons & got two different error msgs depending on the buttons i used.
    I could have sworn that i got the original msg in the custom buttons but i don't think i did.
    I know how to create custom error handling but i was wondering whether their was a way of replicating the native buttons in custom built buttons (i.e. get the same msg in a custom navigation buttons as you do with Access native navigation buttons). I'm just curious about if there is a way of doing this & how much effort it would be.

    Thanks for your help MissingLinq. Really appreaciate it. It's nice to discover the route of your problems & not have to sit around trying to figure out why the errors are occuring.

    Thank again,

    Shuja.

  8. #8
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Rather than letting Access throw an error, in your navigation you can add a small function to make sure your required fields have valid data in them.

  9. #9
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    For each custom button use:

    DoCmd.SetWarnings False

    to turn off Access' warnings

    In the error handling area of the button's on click sub replace:

    Code:
    Err_CustomButton_Click:
        MsgBox Err.Description
    Resume Exit_CustomButton_Click
    with this:

    Code:
    Err_CustomButton_Click:
        'Your message box (copy Access' message if you like)
        ' and error handling routine
    Resume Exit_CustomButton_Click
    Then use:

    DoCmd.SetWarnings True

    to turn Access' warnings back on
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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