I was recently asked to debug a legacy Access 97 (YES, Access 97, lol) database frontend application that is connecting to a SQL Server 7 (Yes, SQL Server 7, lol) backend (Like I said... it's legacy, what do you expect ^_^). To make things worse, I had to debug this through a remote VNC session since the problem is occuring somewhere in Kalimantan and I am in Jakarta. What fun :), ... NOT! Tried debugging it on a local copy that I have (in VM of course, heck, I am not going to install Office 97 stuffs on my main machine, hehehe, although I did this once before when I didn't know better, hehehe. It did work however - side by side Office 97 and Office 2003 installation, haven't tried to do it with Office 2007, nor do I want to - btw, you have to do some tweaking here and there, but it worked. Uhm... Sorry for digressing... Back to laptop, as they said it...), but couldn't reproduce the error no matter what I do. The application ran just fine on the VM. So, the next logical step is to debug it where the problem is actually happening.
Anyhow, the problem presented to me was an error that kept showing up recently that stumped some unknown code module in the system (The error message provided is very generic like 'Unable to fullfil your request', apparently the person who created the application was well versed in security issue, you know... not exposing the internal system error to the client / user, but he forgot to log the real freaking error somewhere else for easy debugging...ARRGH. Oh, btw, if your Access application is hooked up to run some code automatically on load, you can launch it by holding down Shift key and double-clicking the .mdb file to stop the code from running. Sometimes this is necessary to allow you access to the object viewer, etc. Uhm... Back to laptop... (who the heck invented that phrase anyway...)
After setting numerous breakpoints and tracing the code from the startup form up to the point of failure (what a chore... stupid VNC won't allow me to press F8, argh, so I have to click on the VBA debug menu item one click at the time to step into / through some code). Oh, did I mentioned the sucky connection between Jakarta and our site in Kalimantan (in the middle of nowhere, literally in jungle, mining site)? Yeah, the VNC connection broke down on multiple occassions!! OMG. Speaking of hellish debugging session... Sigh. Ok, enough digressing... Back to laptop...
Erhmm... Where were we... oh yeah, after blah blah blah breakpoint, blah, and so on and what not... sigh... it turned out that the error was caused by a SQL Query that is constructed using string concatenation like:
"SELECT Field1, Field2 FROM SomeTable " + _
"WHERE Timestamp = '" + FormatMySillyDate(Now()) +"' " + _
"AND some other criteria here (not important)..."
And when the query got shoved to SQL Server through DAO, SQL just said huh? what date are you talking about... that's not a date!! and gave up.
Aside from the abysmal lacking of clear exception information available from the error handling routine that made debugging this application a hellish experience (oh and the VNC, and the network, etc. etc.), my gut instinct pointed me that this could be a localization issue. Since it worked perfectly on my VM (couldn't reproduce the error, remember?), it's clearly local to this one workstation (and it was confirmed by the operator that the one installed on the other computer is working just fine.) So... after confirming that the formatted date being passed is something like '18-Agust-2008', next step that I took is take a look at the Regional Settings of the computer and sure enough, it was set to Indonesian localization :). Changing this back to English (United States), fixed the problem.
After strongly warning the user about the "danger" of switching Regional Settings unilaterally and forwarded the issue and resolution to the support (help) desk team (just in case, in the future...), I finally could rest in peace, phew... (or if the boss is watching, rest in peace == back to working hard on the gazillions of other projects, simulteneously, and maintenance issues) There goes 2 hours of my life that I'll never get back.
Moral of the story is... you figure it out. I am beat (mentally) from debugging this... (^_^).
I apologize for rambling too much, but didn't you read my blog title? Hehehe.
p.s. Any exaggeration is purely for comical effect and not to be taken seriously. Funnier to read that way... Bah, why am I explaining this... Sigh.