• justsomedude (unregistered) in reply to London Contractor
    London Contractor:
    Ross:
    MegaQuit isn't so bad. Here's two things I can find wrong, but they're not really WTFs.

    First, MegaQuit does two things when it should only do one. One is that it closes all forms; the other is that it asks whether it should quit access, and does so if confirmed. These should be two separate functions.

    The second thing is related. If you're going to quit, why bother closing forms first? And if you do need to close forms before quitting, shouldn't you get confirmation before you start closing them?

    I think in Access you need to manually close all the forms before you can quit - also they could be bound to the database, so you'd need to save any changes as well.

    All the code sucks. Awful.

    That is incorrect. All it takes is "Application.Quit", doesn't matter if forms are open.

  • Hatterson (unregistered) in reply to Hexadecima
    Hexadecima:
    BBT:
    So, for HoldIt... If you call it in the 59th second of the minute, it's guaranteed to infinitely loop. If you call it with "longish" >= 59, it is guaranteed to infinitely loop. If you call it with "longish" greater than or equal to 59 minus the current second, it will infinitely loop.

    That's one brillant function.

    ACTUALLY, HoldIt() would only loop for a minute, not infinitely. Seriously you guys. Seriously.

    Uhh what?

    Second() returns a integer from 0-59 representing the current second.

    startof will be set to 0-59 when the function is called.

    Second(now) in the loop will return 0-59 meaning that if startof + longish >= 59 then temp will never be > longish and it will keep looping

    second(12:00:01) - second(12:01:01) returns 0, not 60

  • HeWhoComesBackToHauntYou (unregistered)

    The real reason why it was slow is because they were using Access, they should have used APDB.

  • Sig (unregistered)

    Interesting... this appears to be one of the more non-wtf clients in the end. Why? Since they called back the guy who they hired first, obviously because of the expertise... and showing more common sense then I've had the chance of seeing.

  • (cs) in reply to Fred Blogs
    Fred Blogs:
    Let's just say we don't hire the brightest users at my father-in-law's company. He's widely known as a tightwad and won't hire anyone for more than minimum wage. Then he forbids outside food and drink, and puts in his own vending machines with $2.00 sodas and $7.50 sandwiches. So ultimately the only people who will work here are those who can't do any math. Hell, they can barely count. And read? Forgetaboudit.
    Sounds like you already know enough to be able to run a business better than he can. Ever thought about starting up a competitor, filching all his customers and crushing his firm like a bug? It'd do both you and him a lot of good, and he'd respect you far more afterwards. (OK, he might hate you too, but respect... sure.)
  • Darkstar (unregistered) in reply to BBT
    If you call it in the 59th second of the minute, it's guaranteed to infinitely loop. If you call it with "longish" >= 59, it is guaranteed to infinitely loop. If you call it with "longish" greater than or equal to 59 minus the current second, it will infinitely loop.
    Well... if you call it with 59, it will just wait until the next leap second, given that Microsoft got their code right. (Yes, 23:59:60 is indeed a valid time expression - go rewrite your regexes, folks.)
  • Anonymous (unregistered)

    "pulled-out" should be "pulled out". It's a verb followed by an adverb (like "log in" or "set up" or "frame up"), not a phrase acting as a noun (like "log-in or "setup" or "frame-up").

  • (cs) in reply to Anonymous
    Anonymous:
    "pulled-out" should be "pulled out". It's a verb followed by an adverb (like "log in" or "set up" or "frame up"), not a phrase acting as a noun (like "log-in or "setup" or "frame-up").

    Known well to "Anonymous" since conception.

  • mike (unregistered) in reply to rfoxmich
    rfoxmich:
    WTF/KLOC is the standard measure. Problem is that number is usually >> 1

    Divided by 2?

  • Chutney (unregistered)

    So, do you think Fred was fired, or MegaQuit?

  • Aussie Contractor (unregistered) in reply to highphilosopher
    highphilosopher:
    .... an Access Database. It's the breeding ground where they usually start.
    Well what can I say, I started out build Access Databases and here I am six months later charging $110/hr to read blogs on the internet, which I am guessing is actually saving the client money by keeping me away from the codebase. Everybody wins.

    Captcha: nibh - Where Billy Madison goes to school.

  • (cs)

    "Dim FredBlogs" How prescient.

  • Aaron (unregistered)
    Dim FredBlogs

    That part seems accurate.

  • Aaron (unregistered) in reply to monkeypants
    monkeypants:
    "Dim FredBlogs" How prescient.
    Darn it, monkeypants. ;)
  • (cs)

    What it says:

    Application will close. Continue?

    OK / Cancel

    What it means:

    The application has closed already. If you had any files open, sucks to be you. But hey, if you want, press Cancel here and I will restart the application for you!

    OK / Cancel

  • Fred Blogs (unregistered) in reply to Abdiel

    Hey at least I gave them a moment of false hope, instead of those dialogs that say "you're toasted, all your data will be gone as soon as you click OK" and then only offer one choice: OK.

  • me (unregistered)

    love how everything's a variant... great use of memory...

  • David W. Fenton (unregistered)

    The intention of MegaQuit() is good, to provide a single exit point for the app, and to insure that cleanup code runs.

    It's a horrid implementation, though.

    As to closing forms before exit, it's not necessary, but there are reasons why you would do it because there's a certain bug in Access that when you close a form a certain way, a dirty record may not be saved.

    Properly writing the code to handle that would mean checking if each form is dirty before closing it, and forcing the save before closing, so that if any errors happen in the save, it can be handled appropriately.

    The criticism that the code is disorganized is completely correct though -- very user-hostile to lose the application state and then ask if they user wants to exit.

    The other stuff is indefensibly comical.

    I get hired all the time to fix old and broken Access apps. Most of them have absolutely no VBA code (though often hundreds of tangled macros), or only code that was created by the Access wizards. This one looks like it was written by someone who didn't understand the Access model (i.e., build your UI objects with point and click and wizards and then tie them together with some well-written code, only as much code as is essential to get the job done), perhaps a refugee from some other programming environment where you have to code the most basic functionality.

    FWIW, I've seen really bizarre code in all sorts of different languages. I don't think there's anything specific about VBA/Access. Sturgeon's Law and all that...

    -- David W. Fenton David Fenton Associates http://dfenton.com/DFA/

  • (cs)

    Sure, you can post all nice and concise when you are using your real name, but the real test of character is if you can do it while anonymous.

  • (cs) in reply to Patrick
    Patrick:
    You have to at least give credit to Fred for trying out some AI in the error handling. Too bad he basically made an artificial retard...

    I joined just to say how MegaAwesome this comment is.

  • soporific (unregistered)

    Damn! I wish i had thought of MegaQuit!

    The database i currently maintain has Mega Search, just not Mega Quit. Damn!

  • Baaaaa! (unregistered)

    Well, this makes perfect sense on an embedded platform with no file system. It's strange that nobody pointed it out already.

  • (cs)

    What, no IT Crowd reference?

  • filo (unregistered) in reply to Hexadecima
    Hexadecima:
    BBT:
    So, for HoldIt... If you call it in the 59th second of the minute, it's guaranteed to infinitely loop. If you call it with "longish" >= 59, it is guaranteed to infinitely loop. If you call it with "longish" greater than or equal to 59 minus the current second, it will infinitely loop.

    That's one brillant function.

    ACTUALLY, HoldIt() would only loop for a minute, not infinitely. Seriously you guys. Seriously.

    It loops infinitum depending on what time you call it. If we pass in 20 seconds and seconds(Now())=50 what is the max value of temp.

  • Curious Error Messager (unregistered)

    Most of this is indeed awful - but the curious error message text is quite endearing and might have a point to it.

    I've found that users' descriptions of error messages tend to be a little inaccurate, so I tend to write ones that are stylistically quirky so that they're easy to identify even when I hear a garbled account of them. This guy's users probably see errors even more than mine do, so it might be even more important to him.

    CAPTCHA "odio" - I hate - but I don't, much

  • Anonymous (unregistered) in reply to Sponjk
    Sponjk:
    How, roughly, do you tell "Good" VB from "Bad" VB?
    Easy - if you're currently residing in Opposite Land then it's all "good" VB. If you live in the real world with the rest of us it's all "bad" VB. Simple.
  • gdjfkghl (unregistered) in reply to Fred Blogs
    Fred Blogs:
    Hence my challenge. When an error message occurs they just ignore it. So I was asked to make them more amusing. No effect. They skip right by them. Finally, old skinflint himself told me -- not asked -- to lock up their computer after every error so they can't do anything else until they read the frickin screen already goddammit!

    Did you redefine MsgBox sub? Can i see the code?

    P. S.: CAPTCHA is "genitus"

  • (cs) in reply to me
    me:
    love how everything's a variant... great use of memory...
    You don't really think that wasting 22 bytes is the worst part about using variants, do you?
  • JSampson (unregistered)

    Ok my google foo is weak today, and I am not much of a DBA, what is a 'dirty' record? (aside from a music label in New Zealand)

  • Anonymous (unregistered) in reply to JSampson
    JSampson:
    Ok my google foo is weak today, and I am not much of a DBA, what is a 'dirty' record? (aside from a music label in New Zealand)
    For real? OK, well, it's just a modified (but unsaved) record. This is a common term that is not specific to DBs. Modified but unsaved.
  • (cs) in reply to Anonymous
    Anonymous:
    JSampson:
    Ok my google foo is weak today, and I am not much of a DBA, what is a 'dirty' record? (aside from a music label in New Zealand)
    For real? OK, well, it's just a modified (but unsaved) record. This is a common term that is not specific to DBs. Modified but unsaved.

    OK, since you're answering questions. What if I replace record with Sanchez?

  • Hexadecima (unregistered) in reply to frits
    frits:
    Anonymous:
    JSampson:
    Ok my google foo is weak today, and I am not much of a DBA, what is a 'dirty' record? (aside from a music label in New Zealand)
    For real? OK, well, it's just a modified (but unsaved) record. This is a common term that is not specific to DBs. Modified but unsaved.

    OK, since you're answering questions. What if I replace record with Sanchez?

    Well, then it moves from New Zealand to California and becomes a band instead of a whole label.

  • Mr. Fancy Pants (unregistered)
    <UT2004AnnouncerVoice>

    M M M M MegaQuit!

    </UT2004AnnouncerVoice>
  • Andrew Wade (unregistered) in reply to Curious Error Messager
    Curious Error Messager:
    I've found that users' descriptions of error messages tend to be a little inaccurate, so I tend to write ones that are stylistically quirky so that they're easy to identify even when I hear a garbled account of them. This guy's users probably see errors even more than mine do, so it might be even more important to him.
    In my Access apps, I've logged unexpected errors in addition to throwing up a dialog - I've found that works well and is worth adding ugly boiler-plate code to each function. (No tracebacks for errors are available - If you want to assemble a call stack for an error, you have to do it yourself. Bleh. And just give up on logging a line number for the error; there's no sane way to do that. But you can often guess what happened from just an error message and function name alone.)
  • David W. Fenton (unregistered) in reply to Andrew Wade

    You can get the line number with Erl if you number the lines of code, like old-style BASIC.

  • Coder (unregistered) in reply to David W. Fenton
    David W. Fenton:
    You can get the line number with Erl if you number the lines of code, like old-style BASIC.

    The crazy thing about that method is that the line numbers STAY THE SAME on each line, even when you add new code.

    So you come back a year later, and line number 75832 still points to the same code it pointed to last year!

    Crazy language.

  • lokey (unregistered) in reply to Bubba
    Bubba:
    A bit of .Net would fix that right up.

    But it needs XML too

  • Easily impressed (unregistered)

    You comment guys and gals are aweseome. As the manager of a small dev team, I now have this dream where I post my team's s**t code up here and have you guys gently and sardonically take the piss out of them. Seriously, when you consider both the appalling level of sophistication, sensitivity and even basic grammar of your average YouTube comment, the comments here are on a godlike level. Keep up the good work, you are all clearly wasted in your day jobs as coders.

    Your reward is now to recieve my response to the original post, in the stylee of a YouTube commenter:

    What the FUCK does WTF mean aneeway? YOU are all GAY! FredBloggs is a dickwit that probably sucks gay ass cos he is too fuked to actooally know shit like I do. I bet he is blak too and anyway Laydy Gaga has a dik

  • (cs)

    At least the database admitted something was wrong rather than some other Access databases I have come across which tried to dismiss the error messages and go off in its own macro induced tangent, or like the one I had the misfortune to try and fix a couple of years ago where the message boxes and error messages bordered on abuse from the database.

    One particular error message sprang to mind was: 'You forgot to enable the complier Smeghead, I will not do anything until you go back and turn the f**king thing on you sorry excuse for being Human.'

    Needless to say one of the jobs my team had to fix was the supposed attitude problem the Access database had towards its users.

  • Andrew Wade (unregistered) in reply to David W. Fenton
    David W. Fenton:
    You can get the line number with Erl if you number the lines of code, like old-style BASIC.
    Yeah, I decided numbering every line just for Erl just wasn't worth it.
  • computerquip (unregistered)

    MegaComment()

  • LLJ (unregistered) in reply to frits

    Can't he go back and enter it now?

Leave a comment on “Fred Blogs' MegaQuit()”

Log In or post as a guest

Replying to comment #:

« Return to Article