Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error Message (Access 97)

    I have a form where the primary key is the persons initials and a date. Only one record per initial on a specific date. If someone tries to enter another record with the same initials and date, they get an error message that reads, "You can't go to the specified record. You may be at the end of a record set. " I would like the error message to be more user friendly like, " Record for those initials and date already entered." I think I would want to put code in the After Update event of the form. How would I code this??

    Also, is there anyway to bring up the record that they are trying to duplicate?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Error Message (Access 97)

    When you say "someone tries to enter another record with the same initials and date", exactly what is the situation? The error message you are getting seems to indicate you are in a Find situation (not actually adding a new record yet). If you were trying to add a new record, then the Form's BeforeUpdate event would be the place to test for the existenance of a record with same initials and date. (and unless you have about 3 people in your database, using initials as a unique identifer is not a good idea in the long run.)
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Message (Access 97)

    The form is set up for data entry. There are only 8 people using the form to enter what they did for the week. They enter their initials and monday's date of the week they are reporting for and then they enter the data into the fields that apply to them and click on Add Record . Sometimes they enter their initials and the same date again and try to enter another record. Thats when they get that error message.

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Error Message (Access 97)

    Well, it's still an odd message, given the circumstances. But anyway, in the code for Add Record (apparently they've already entered their initials and date, and click Add Record to actually save info), you need to do a DLookup to see if a record exits with same initials and date. If it does, then Exit Sub immediately.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    Lounger
    Join Date
    Apr 2001
    Location
    KY USA
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Message (Access 97)

    You could always put a message box in the error trapping of the before update event of the form that said,

    if msgbox("You have had an error trying to save this record. Perhaps you've already entered your report for this day. Would you like to search for your entry for today?",vbyesno) = vbyes then
    docmd.runcommand accmdfilterbyform
    docmd.runcommand accmdcleargrid
    end if

    This would prompt them with a yes/no question. If they answer yes then they will go into a filter by form so that they could look up their entry for that day. If you wanted to, you could also include some code to copy the "comments section" of the form so that they could hit CTRL V and paste the additional comments onto the end of the existing report.

    Jeff Dever

Posting Permissions

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