+ Reply to Thread
Results 1 to 8 of 8

Else warning not being triggered

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Else warning not being triggered

    I wanted to add a safeguard to a database amendment command to ensure that the details were written back to an exact match in the search column

    The code works

    If I remove a few letters from the name in Ddtxt_01 the code will ignore as no match and no cells are overwritten

    But the warning message isn't shown. What am I missing in the order of the code

    Please Login or Register  to view this content.
    Last edited by nigelog; 02-13-2017 at 11:27 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Else warning not being triggered

    There are a number of errors on your code, but all are masked by resume next.

    Please Login or Register  to view this content.
    Last edited by AB33; 02-10-2017 at 11:08 AM.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Else warning not being triggered

    With lrow as a range you would need "SET" in front of the Find, but with .row that will not work, unless I'm very mistaken. I might suggest a small change to AB33's code (try his in case I'm wrong, entirely possible):
    I removed .Row from the find, other changes in red

    Please Login or Register  to view this content.
    Last edited by Arkadi; 02-10-2017 at 11:43 AM. Reason: Updated code, forgot to change the find command back to the textbox value, I had used a string for testing.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Else warning not being triggered

    Arkadi,
    Yes, you are right. I did not test the code. I was trying to press home that the error trapping is hiding the error.
    I used to put this hideous line at the top of my code in the hope that the code does not error and simply runs. Looking back, I cringe. .

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Else warning not being triggered

    @ AB33 IKR! I did it too, I must admit that sometimes for a single line or set of lines I implement on error resume next, but that is in a very controlled and limited context.
    Skipping errors is not a great way to go 999 times out of 1000.
    Btw, thanks for the rep AB33, not required but appreciated

    @nigelog, when using "resume next", which is usually not the best solution, if you experience problems, disable it at least temporarily to troubleshoot, then once you are satisfied (or have gotten to the source of the problem) you can always re-enable it.
    Last edited by Arkadi; 02-10-2017 at 11:41 AM.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Else warning not being triggered

    That is precisely how it should implement it. You need to remove it after you trapped the culprit line, but leaving it open makes all the subsequent errors to be hidden.
    I think Microsoft should put in a big sticker warning when ever some one use this line to warn them its pitfalls. Novice programmers might not aware its deadly consequences.
    Some people also misuse or even abuse it, like the try and catch in C driven languages.

  7. #7
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Else warning not being triggered

    Thank you both for your educational comments.... had wondered how wide a scope On Error Resume Next command had

    All sorted - many thanks - will mark as solved

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Else warning not being triggered

    Glad we could help nigelog

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Auto_Open Eevent not getting triggered
    By Tusharp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2013, 11:32 AM
  2. SheetFollowHyperlink Event NOT triggered
    By luckylooke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2011, 02:16 AM
  3. Worksheet_Change Not Being Triggered
    By Claymation in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-01-2010, 11:56 AM
  4. DDE - which cell triggered a changed value?
    By jonmac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-30-2010, 03:47 AM
  5. Email triggered by excel
    By Chemistification in forum Excel General
    Replies: 1
    Last Post: 11-04-2009, 03:51 PM
  6. Need a triggered formula.
    By chadontheboat in forum Excel General
    Replies: 4
    Last Post: 06-14-2006, 06:55 PM
  7. Triggered screen shots
    By Barry Taylor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2006, 12:18 PM
  8. triggered printing
    By that_michael in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2005, 05:51 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1