Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone interested in Access OOP sample code?

Status
Not open for further replies.

tcl

IS-IT--Management
Mar 5, 2001
15
US
I've been doing an Access project recently, but my previous gig was with Java and it prompted me to explore using OOP techniques with Access, so while I was waiting for my client to get rolling, I developed a non-trivial example of OOP with Access. The example creates a UI for an administrator to assign students to classes; a classic many-to-many relationship. I developed the UI 3 ways: using bound controls, using unbound controls, and using OOP. The bound version took about 2 pages of code. The unbound, about 2 1/2 to programmatically populate listboxes, and the OOP version about 10 pages. The OOP version is pretty sophisticated, though, it uses the Model-View-Controller model with a 3-tier architecture. After finishing, it's clear that the bound version was really quick to develop (an hour of work) at the cost of flexibility and control. The OOP version took nearly 2 days and is really flexible, but seems unjustifiable for a small project. Anybody interested in looking at the code and commenting? I'd be interested in other's opinions.
 
Sounds interesting. Do you have website to post it on? Threads where people ask for copies get to be 100 posts long or more. In any case, I'd love to see it. If you don't have a website, I can post it for you on mine.

please send it to tclFromTekTips@ymerej.com, if you don't get it up on a website.

Thanks.

Jeremy ==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
You can download the project from
It's a 700KB Access 2002 mdb. Check out the module named AboutThisProject for a description of which classes go with which sample. To run the bound, unbound, and OOP samples, just open the form, which is obviously named, i.e., frmAssignStudentsToClassesUnBound. To run the Person inheritance sample, run the TestImplementsStatement module. I'm pretty confident that if you browse the code and then maybe trace through it, you'll figure out how things are working pretty quickly. The class modules are pretty well commented. I'll be interested in any comments you have.
 
Excellent. Thanks. I'll grab this at home sometime shortly.

Jeremy ==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Ah, one thing I forgot to mention in the AboutThisProject module, the references. You'll need to have references to the following:
Microsoft DAO 3.6 Object Library
TypeLib Information (TLBINF32.dll)
Microsoft Scripting Runtime (scrrun.dll)

All should be in the System32 directory.
 
I just finished porting the project to VB6. The code ported fine except for the "Option Compare Database" statements and the Access Listbox controls. I had to replace the Listbox controls with the ListView Common Control to provide similar functionality. VB's native listboxes don't support multiple columns. One mistake is that I shouldn't have assigned the form controls to the controller classes member variables directly; instead, I should have built wrappers for the textbox and listbox controls so that I could swap the control types without touching the controller code.
 
I mispoke before, the mdb is in the Access 2k format, not 2k2.
 
Hi tcl,

I downloaded your app, it looks very professional but when I try to use it, it falls over whenever it encounters AddItem or RemoveItem. I know that Access '97 and 2000 doesn't support these Methods for Lists/Combos normally, does Access 2002 (haven't got it yet) or have you discovered an .ocx or .dll etc that does allow them. I'm keeping my fingers crossed that you have, because it would make my programming life so much easier.

As I say your app looks very good, keep up the good work.

Bill
 
Sorry Bill,
I used Access 2k2 for the project but Access 2k file format. I have all 3, but of course, I use the latest if there's no reason not to. Frankly, I'm surprised by how many different listboxes are out there. I thought DLL's were supposed to take care of that kind of redundancy?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top