Results 1 to 3 of 3

Thread: Run-time error '524'

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    Hi, everybody!

    I have a button called "Save" which the user clicks on after entering all the data in my form.

    If the user adds a duplicate value, VB displays a message box:
    Run-time error '524'
    The changes you requested to the table were not sucessful because they would create duplicate values and so on ...
    and the buttons End, Debug, etc...

    The message avoid duplicate data, ok, but it can cause some problems...

    How can I "capture" this error (524) and display a simple message, instead of the VB one, (which is going to scare my users :-O who don't understand English). They may get scared also if they click on the "Debug" button and get into the code ...

    I pretty sure that solving this problem is a piece of cake for you, folks, but, I couldn't solve it so far.

    Feel free to pull my legs :-), but, please help!

    Thanks in advance,
    Roselene


    [This message has been edited by Roselene (edited 02-08-2000).]

  2. #2
    Guest

    Post

    The Debug button is only aviable in the dev-enviroment, if u compile the code to an exe, ocx (..) an run it, you simple will get a " RUNTIME ERROR" error message with an button called ok. if u press ok, the programm will terminated most times.

    try ON ERROR RESUME NEXT or ON ERROR GOTO

    taLON

    f.e.:

    Sub cmdSave_Click()
    On Error Goto ErrorTrap
    ...
    [your code goes here]
    ...
    exit sub
    ErrorTrap:
    replMSG = Msgbox ("An error occured :" & vbrlf & err.number & " : " & err.description & vbcrlf & vbcrlf & "Press OK to continue or CANCEL to exit the programm.",vbokcancel,"Error")
    if replMSG = vbcancel then end
    resume next

    end sub

    -----
    argh.. need to visit an english curse

    [This message has been edited by taLON (edited 02-08-2000).]

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    taLON,

    Thanks for taking the time and trouble to help me. I really, really appreciate that.

    yes, I've forgotten that the project will be turned into an .exe and that it's going to change their behavior in some situations. So, people won't be able to see and change the code, but I still think it would be nice avoid the VB error and let my user know what's going on.

    So, I'll try to use the sample code you've sent me, but I'll bet it works.

    English course? why?
    I'm attending English Classes, cause -I-really need to improve my English...

    See you, :-)
    Roselene

Posting Permissions

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



Click Here to Expand Forum to Full Width