• Squiggle (cs)

    Rule of 3: If you have to code it more than twice, refactor it into a generic or abstract process.

    Looks like these developers are going by the rule of 300.

    THIS [code] IS MADNESS!

  • joe.edwards (cs) in reply to Squiggle

    Madness? THIS-- IS-- ACCESS!

  • wtf (unregistered)

    I think that:

    But on the other hand:

    What I don't get is:

    Or maybe the article isn't finished yet?

  • Outlaw Programmer (cs)

    This is a perfectly cromulent way to avoid buffer overflow attacks!

  • Will (unregistered) in reply to wtf
    wtf:
    I think that:

    But on the other hand:

    What I don't get is:

    Or maybe the article isn't finished yet?

    Yes and I agree. Because of this. agree?

  • Yazeran (unregistered)

    WOW! Although the it is a long time since I have done anything in either Access or BASIC (in any of it's incarnations) this is over the top, I can hardly see what is happening except the horrible triple loop wherein the database is queried IN EACH INNER LOOP!!!! It looks as a to me something like this (pseudocode)

    for () { for () { for() { connect_to_database(); query_database(with_newly_created_sql_each_time); disconnect_form_database() } } }

    And they wonder why it is slow????

    Someone please tell me I'm wrong and that VB (or whatever) can handle parameterized queries run multiple times with diferent input!!!

    Yours Yazeran

    Plan: To go to Mars one day with a hammer.

  • Yazeran (unregistered) in reply to Yazeran

    It's even worse, there is also the possible SQL-injection to make life interesting (hopefully this wasn't on a web server....)

    Yours Yazeran

    Plan: To go to Mars one day with a hammer.

  • Zylon (cs)

    Yeah, this article is obviously missing some chunks. Guess I'll check in tomorrow and see if it's been fixed.

  • *sigh* (unregistered)

    The best WTF is even missed for non-dutch (belgium actually by the look of the tags) readers..

    The only comment in the whole code is: 'dit lijkt me duidelijk translated: 'this seems obvious to me

  • jimbo (unregistered)

    Your server obviously isn't fast enough :)

  • akatherder (cs)

    A hardcoded XML array would be the perfect solution for this.

  • Marvin the Martian (unregistered) in reply to *sigh*
    *sigh*:
    The best WTF is even missed for non-dutch (belgium actually by the look of the tags) readers..

    Nah, it's perfectly valid dutch, there's 2.5 times more dutch than flemish speakers, and the submitter's name is obviously dutch... No reason to conclude it's belgian code (nor to rule it out completely).

    Given that Belgium will soon stop existing (government fell 200days ago and nobody noticed yet), it might become a valid piece of history it it were belgian though.

  • AMerrickanGirl (unregistered) in reply to Yazeran
    Yazeran:
    WOW! Someone please tell me I'm wrong and that VB (or whatever) can handle parameterized queries run multiple times with diferent input!!!

    Yes, of course VB can run parameterized queries. You pass it any number of parameters, and it can take appropriate action. There isn't any overloading or inheritance or anything like that in VBA (not really, although the newer versions offer class modules).

    No, this mess is not a function of VB being a bad language. It is a result of programmers (and I use that word loosely) who don't know what they're doing.

    Captcha: conventio

  • Kederaji (cs) in reply to joe.edwards

    Our arrays will block out the sun!

  • Vincent (unregistered) in reply to Marvin the Martian
    Marvin the Martian:
    *sigh*:
    The best WTF is even missed for non-dutch (belgium actually by the look of the tags) readers..

    Nah, it's perfectly valid dutch, there's 2.5 times more dutch than flemish speakers, and the submitter's name is obviously dutch... No reason to conclude it's belgian code (nor to rule it out completely).

    Given that Belgium will soon stop existing (government fell 200days ago and nobody noticed yet), it might become a valid piece of history it it were belgian though.

    I also don't really see any Flemish characteristics, but then again, I'm far from an expert when it comes to Flemish.

    Anyway, another Dutch WTF, we're not doing well :(

  • Jim (unregistered)
    On Error GoTo fail

    Indeed.

  • oppeto (unregistered)

    the real WTF is someone using access and VB

  • Timothy (unregistered)

    The real WTF is that someone is using VB.

    Alex, I'd like to buy VB some braces! "{}"

  • John Bigboote (cs)

    Have you given any thought to how long it takes the Access runtime to convert all that Dutch to English?

  • tamosius (unregistered)

    God, help marinus!

  • Kiel (unregistered) in reply to Kederaji
    Kederaji:
    Our arrays will block out the sun!

    Then we shall code in the basement...

  • David Walker (unregistered) in reply to Timothy
    Timothy:
    The real WTF is that someone is using VB.

    Alex, I'd like to buy VB some braces! "{}"

    Yuck. I hate braces. Not to start a language war, but VB is a fine language to program in if you're not an idiot. It's simple to get started in, therefore idiots can write "code" in VB.

    And I hate braces.

  • Andrew (unregistered)

    In the short time I've spent developing database applications, I've come up with a handy rule of thumb:

    If you're using Access, you're doing something wrong.

  • John Bigboote (cs) in reply to Andrew
    Andrew:
    In the short time I've spent developing database applications, I've come up with a handy rule of thumb:

    If you're using Access, you're doing something wrong.

    It allows people who don't understand nerdy stuff like 1NF to develop databases quickly. What could possibly go wrong?

  • Villa (unregistered)

    Is that first paragraph a reference to the Matrix, or has my mind been too warped by those movies?

    CAPTCHA: odio. Yo también odio los WTF (QP in Spanish :P)

  • JimM (unregistered)

    Arrgh! I just wrote a huge comment on this and the flipping forum software and IE combined to obliterate it!! I'll try to summarise:

    While True ... Wend used with On Error GoTo label as a termination condition? And no error checking when it skips out to the label? Gah!

    Access: it's not a WTF people. It's a bad choice compared to most of the options that companies with a proper IT department can get hold of, but not every company has a proper IT department. It happens to be the best option that most places have for data apps (and is so much better than storing data in Spreadsheets). Plus, if it's used by a competent developer Access / VBA is actually a decent development environment for small, limited user data applications. There are much worse db WTFs (Paradox, for example ;^) )

    And finally - whoever mentioned the nested loops and SQL statements: yes, it's there; no it's not elegant; but since each iteration fires off a single SQL statement which updates, inserts or deletes a single, 4 field record, it's unlikely to be a major performance hit... and compared to the rest of this code...

  • TroelsL (unregistered)
    Comment held for moderation.
  • Anon Coward (unregistered)

    The WTF begins with "access" and "database" in the same sentence.

  • VB (unregistered) in reply to David Walker
    David Walker:
    Timothy:
    The real WTF is that someone is using VB.

    Alex, I'd like to buy VB some braces! "{}"

    Yuck. I hate braces. Not to start a language war, but VB is a fine language to program in if you're not an idiot. It's simple to get started in, therefore idiots can write "code" in VB.

    And I hate braces.

    I didn't think too much of braces when I was in C++ 101, but they are cleaner than the equivalent VB key words, which sometimes seem to fill up the page with letters, all jostling and crowding each other.

  • Troy McClure (unregistered) in reply to VB

    scheisse!!!!!!

  • Anonamoose (cs)

    If you need a tool to deliver a report(s) to users that utilize headers and footers Access is an acceptable solution. I know Reporting Services is out there, but for a long time it wasn't and Crystal is amazingly expensive when you can do it for free using Access.

    Second, when creating Access apps, code all your connections using ADO. It's more time consuming, but pays off in reliability (no relinking), and easier to trouble shoot(runs all code through debugger).

    Access tables should only be used to display data in bound forms. Data Access pages are cool, but for a lot of the Access work I have done I needed to loop record sets in business logic and then display the results. Hence, the display tables and bound forms.

  • accident (unregistered)

    i think article poorly wrote in long ever

  • Leak (cs)

    Oh my god, it's full of FAIL!

  • <myName>Nunya Bidness</myName> (unregistered)

    There is no such thing as an "Access Programmer". Any one who programs in Access is a wanker who will ultimately drive your business into bankruptcy with their hideous software creation.

  • Troll on a roll (unregistered) in reply to Kederaji
    Kederaji:
    Our arrays will block out the sun!
    Then we will code in the dark!
  • T $ (cs) in reply to Anonamoose
    Anonamoose:
    If you need a tool to deliver a report(s) to users that utilize headers and footers Access is an acceptable solution. I know Reporting Services is out there, but for a long time it wasn't and Crystal is amazingly expensive when you can do it for free using Access.

    Second, when creating Access apps, code all your connections using ADO. It's more time consuming, but pays off in reliability (no relinking), and easier to trouble shoot(runs all code through debugger).

    Access tables should only be used to display data in bound forms. Data Access pages are cool, but for a lot of the Access work I have done I needed to loop record sets in business logic and then display the results. Hence, the display tables and bound forms.

    Finally, someone who has an informed opinion regarding Access. I must thank you friend for at least providing some supporting evidence rather than the typical "@CCE55 5UX! HAHAHAHA" or "You 'fo rizzle? @ccE55 Rox!" I'd totally agree with ADODB, it's much more stable. Binding the data directly on the form I'd agree has a really good benefit of simplicity of code, but my experience has been that the unbound style allows a much faster loading of the form if you do the binding on load.

    Even ignoring the way he did some of the code, the naming conventions and not declaring data types early make this look a whole lot more confusing than it needs to be. To other people, I say don't throw away an entire language just because someone doesn't know how to code. Instead, try it on your work projects, realize that it sucks, and bring back a convincing argument as to why it sucks as bad as it does, otherwise I will ignore you. Sorry for the rant, but Access really needs to be given more of a fair shake than it's getting.

  • A Gould (unregistered) in reply to Timothy
    Timothy:
    The real WTF is that someone is using VB.

    Alex, I'd like to buy VB some braces! "{}"

    Andrew:
    In the short time I've spent developing database applications, I've come up with a handy rule of thumb:

    If you're using Access, you're doing something wrong.

    Or you're just not fortunate enough to work in an environment that supports anything else. I have to use VBA because my company won't allow anything else. And when you're building tools to distribute around the company, the only common platform is Office (security policy executables that aren't vetted by Corporate - read: you can't build executables).

    Now, I will agree that Access is by far not the best database out there, but sometimes it's all we have.

  • Sigivald (unregistered)

    You know, I was going to say a lot of things.

    But then, looking at the code, it seems likely this is VB6, and the things I was going to talk about (ie, the most sensible way to talk to an SQL server, etc) are all really .NET.

    And "call"?

    Christ, maybe this is VB5, in which case I'm prepared to overlook a multitude of apparent sins, since that's basically stone knives and bearskins territory.

  • Hugo (unregistered) in reply to *sigh*
    *sigh*:
    The best WTF is even missed for non-dutch (belgium actually by the look of the tags) readers..

    The only comment in the whole code is: 'dit lijkt me duidelijk translated: 'this seems obvious to me

    You missed some comments:

    x% = CInt(rs.Fields(0).Value) 'x Y% = CInt(rs.Fields(1).Value) 'y z% = CInt(rs.Fields(2).Value) 'z

    Obviously, the person who wrote this code did not consider this obvious...

    Best, Hugo

  • algar (unregistered)

    What the Schnitzel?

    For a moment there I thought this is German in the code. Seems though I missed the real point of origin by a single border crossing somewhere in the plains of north-west Germany.

    captcha: genitus ... hm, sounds latin

  • SomeYoungGuy (unregistered)

    I can't read that.

  • draxfelton (cs)

    One can make a career out of converting Access databases to real applications..

  • John Bigboote (cs) in reply to draxfelton
    draxfelton:
    One can make a career out of converting Access databases to real applications..

    We have three developers working on it full-time.

    I used my senior developer privilege to opt out. I enjoy having a will to live.

  • David Walker (unregistered) in reply to VB
    VB:
    David Walker:
    Timothy:
    The real WTF is that someone is using VB.

    Alex, I'd like to buy VB some braces! "{}"

    Yuck. I hate braces. Not to start a language war, but VB is a fine language to program in if you're not an idiot. It's simple to get started in, therefore idiots can write "code" in VB.

    And I hate braces.

    I didn't think too much of braces when I was in C++ 101, but they are cleaner than the equivalent VB key words, which sometimes seem to fill up the page with letters, all jostling and crowding each other.

    Huh? You don't need any more "key words" than C# has. Just use If, Then, Else, and End If to mark things. Just like C#, but without the braces.

  • ben (unregistered)

    "You don't need any more 'key words' ... "

    OK, sure ...

    "Just use If, Then, Else, and End If"

    "Then"? "End If"? Hmmm.

  • Disgruntled DBA (cs)

    At least they didn't use "On Error Resume" so they can catch, and display the error.....er....nevermind.

  • Jeff S (cs) in reply to AMerrickanGirl
    AMerrickanGirl:
    Yazeran:
    WOW! Someone please tell me I'm wrong and that VB (or whatever) can handle parameterized queries run multiple times with diferent input!!!

    Yes, of course VB can run parameterized queries. You pass it any number of parameters, and it can take appropriate action. There isn't any overloading or inheritance or anything like that in VBA (not really, although the newer versions offer class modules).

    No, this mess is not a function of VB being a bad language. It is a result of programmers (and I use that word loosely) who don't know what they're doing.

    Captcha: conventio

    Easy, quick way to tell a good programmer from a bad programmer (handy if you are interviewing):

    Show the programmer poorly written code in VB6 or Access. Ask their honest opinion. If their response is "Of course this code is bad, VB/Access sucks!", then they are an ignorant, inexperienced, "blind sheep" programmer who will constantly blame tools and other things for their own shortcomings, and will never take responsibility for their own work.

    If their response is "this CODE is really poorly written, it can be done better", then they know how to think independently, take ownership for their work and responsibility for what they do, and they will leverage whatever tools available to get the job done as well as possible.

    We've covered this many times here before, kids, but let's all repeat it again: it ain't the tool, it's the programmer.

    And, once again, for those who mindlessly repeat "the real WTF is using Access", then I ask you this: Are YOU, as a "talented programmer", capable of writing good, clear, clean code in Access, or would you fail miserably? If you answer "no", then you either are a really poor programmer or you don't have a clue how to use Access.

  • SomeCoder (unregistered) in reply to A Gould
    A Gould:

    Or you're just not fortunate enough to work in an environment that supports anything else. I have to use VBA because my company won't allow anything else. And when you're building tools to distribute around the company, the only common platform is Office (security policy executables that aren't vetted by Corporate - read: you can't build executables).

    Now, I will agree that Access is by far not the best database out there, but sometimes it's all we have.

    That company sounds like the real WTF. Get out while you can!!! :)

  • mfah (cs)

    In Soviet Russia, Access uses YOU.

    I mean, Access? HA HA HA HA HA HA HA HA HA HA HA HA HA.

  • mfah (cs) in reply to David Walker
    David Walker:
    VB:
    David Walker:
    Timothy:
    The real WTF is that someone is using VB.

    Alex, I'd like to buy VB some braces! "{}"

    Yuck. I hate braces. Not to start a language war, but VB is a fine language to program in if you're not an idiot. It's simple to get started in, therefore idiots can write "code" in VB.

    And I hate braces.

    I didn't think too much of braces when I was in C++ 101, but they are cleaner than the equivalent VB key words, which sometimes seem to fill up the page with letters, all jostling and crowding each other.

    Huh? You don't need any more "key words" than C# has. Just use If, Then, Else, and End If to mark things. Just like C#, but without the braces.

    Surely "Then" should be deprecated (or at least optional) by now? It even fails in the original BASIC's goal by not being valid English a lot of the time.

    And don't get me started on the "ElseIf" keyword...

Leave a comment on “Developing in Access”

Log In or post as a guest

Replying to comment #:

« Return to Article