Saturday, January 29, 2011

Fighting the effects of blogrot...

Ok, I have to admit, I love blogging, but I'm terrible at it. Blogging's like this idea that promises to be life-changing in one way or another that one attacks with enthusiasm, only to find that, about three posts later, either the creative juices have dried up, or the opportunity to express oneself isn't worth the effort it takes to put up a post.

Such as it is, I'm renewing my commitment to blog regularly. I say this while thinking of all the blogs I've wandered across in my time which start out similarly only to have three posts following, and all of them no less than three or four years old...

But in this case, I've got a reason: The VBA Composite Control project I started (see link at left).

I don't know why I started this project. I don't really presume to be able to make it something great. The fact that it's written in VBA is pretty self-limiting. But I get a kick out of this sort of stuff and I really want to make as much of it as I can - if for no other reason than because I enjoy doing so.

So I plan on using this blog to post about what I've got in mind for the project and other related subject matter.

My only hope is that someone may care enough to contribute.

In the interim, I've got lots of plans for the project. I don't plan on releasing another update soon, but I do want to finish out the tutorials (they're getting there) and start developing a data source object model to provide data management to the object model. I'm also playing with techniques to bring more advanced OOP concepts into VBA that aren't natively supported (like reflection and inheritance). In fact, I've written a couple CodeProject articles about it, one on the Object Model, and the other on Reflection in VBA.

In the meantime, if you read this and you've messed around with the object model, and you have thoughts / comments / questions...

I'm dying to hear them.

Sunday, January 16, 2011

VBA Composite Control Object Model

When I turned 16 and got my license, I took to the road in a 1988 Buick Somerset. It was a nice car, I’ll admit. But it wasn’t as cool as my friend’s beat-up 1984 Monte Carlo.

Not that I disliked my Somerset, but it’s just not cool to drive a car named after a retirement village in Florida when you’re in high school. In all honesty, I’d have traded my nice Somerset for my friend’s Monte with its dents, torn seats, dash cracks, stained carpets, and odd smells in a second. Why? Because when you grow up in a village of 200 (196 people, 4 llamas) surrounded by acres of cornfield, you make your own fun. And an old beater of a car was especially fun because such a vehicle was perfect for making “enhancements”.

Case in point, my friend made one such enhancement by tearing apart his fuzz-buster, burying the sensor in the dash behind the windshield, and tying the output to the seatbelt light. Not only was this a smart move (radar detectors were greatly frowned upon by the local law enforcement), but it was a lot of fun watching his seatbelt light go berserk every time we passed a cop on the road. Not surprisingly, my friend went on to co-found a company that specialized in reprogramming your average four-door grocery getter to humiliate a stock Camaro off-the-line. He’s done things with cars we couldn’t have dreamt of then.

So what’s this got to do with VBA?

Only that I have learned that some of the most useful and valuable things I own are things that I’ve repurposed. That’s why I love VBA. I’ve used it to find unique ways to solve problems, work around software limitations, and otherwise get Microsoft Office to do things that I very much suspect it’s not supposed to do. In short, VBA is how I repurpose Office, particularly Access.

For example, I recently had a post on the Microsoft Access Team Blog on creating dynamic callbacks for controls. That code opened up some possibilities with VBA that I’d never explored. So, I tinkered a bit.

What I came up with is the Composite Control Object Model. Briefly, it’s a way of managing event driven interactions between controls and forms or any other object that can exist in VBA. So far, I’ve used it to create custom visual effects (like the WebButton), bind controls / forms together for easier updating, and enable a TabControl object to have a RecordSource. I think it could do other things, too - like create a javascript-style menu system, or perhaps a filmstrip-style gallery control that manages images stored in a single Attachment field.

However, I’ve reached a point where I can’t really take it much farther. That is, I don’t have enough uses for it to make it really useful. That’s why I’ve started a CodePlex site for it.

Anyway, download the demo. Tear it apart. Use it to repurpose a seatbelt light or two… Whatever.

Just let me know what you think.