DBClass was created to help us avoid the tedium of creating Access data base classes for our VB5 applications.  It creates the classes for us, containing all the requisite lets and gets as well as list/combo box fillers, navigation tags, and other database functions that one would wish to have encapsulated within classes.  The Advanced table update feature allows programs to update only those fields that have been changed - which improves save time to tables containing many fields.  

The default class assumes that your tables' first two fields are the ID field - an autonumber, and a text description field in that order.  Your table should also contain an IsNew - YesNo - field.  If you don't want your tables to have these fields, then simply change the Add function within the generated classes that you build.  As a rule, text fields should allow nulls.  The default class also comments-out the initial recordset creation in the Class_Initialize Sub.  For small tables, you would want to un-comment this line, so that the class recordset is created upon initialization.  In tables with many records, however, you may wish to delay the recordset creation until you can apply a Filter to the class which would reduce the resulting recordset when you call Requery (see Filling a form, below).

The class builder is shareware.  The default class can be changed with the available source code.  Constructive criticism is always welcome.  You need to have VB5, SP3 on your PC already.  If DBClass does not work, then try downloading the full install from www.nesolutions.com.  

The zip includes:
dbclass.exe - the utility - if you have VB5, it should just work
dbclass.txt - this document
errorhandler.cls - a really basic error handler that must be placed with your project
propertyupdate.cls - a DBClass support class... add this and the errorhandler class along with any data classes created by DBClass to your project

DBClass should run from anywhere in your system.  DBClass will create class files within the same directory as your Access mdb files, so you will probably have to move them.  Again, if DBClass does not work on your system, then download the full installation mentioned above - keeping in mind that DBClass was created using VB5!  Northeast Solutions (Dew Design, LLC) will not be held responsible for, well, anything.  So there.  Good luck and enjoy the extra time this utility gives you to spend with family and friends.  The source code will allow you to customize DBClass to create classes for databases other than Access, using ADO, RDO, etc.  


Sample code:
The sample code is for a form that adds a record first, then updates it.  

Filling a form from the class (part of Procedure FillForm):
    ("private oList as New Names" has already been declared, where Names is a class based on the Names Table within my Access database)

    With oList
        .Filter = "WHERE Names.ID = " & CStr(iID) '-- Limit the class
        .Requery  '-- Reset the class' recordset
        '-- Fill the form fields
        txtName(0) = .lname
        txtName(1) = .fname
        txtName(2) = .address
        txtName(3) = .city
        txtName(4) = .state
        txtName(5) = .zip
        txtName(6) = .hphone
        txtName(7) = .fax
        txtName(8) = .ophone
        txtName(9) = .ssno
        txtName(10) = .notes
        chkType(0) = Abs(.buyer)
        chkType(1) = Abs(.seller)
        chkType(2) = Abs(.agent)
        chkType(3) = Abs(.lender)
        chkType(4) = Abs(.professional)
        chkType(5) = Abs(.office)
        chkType(6) = Abs(.mail)
    End With

Adding a new record:
        Call oList.Add  
        Call FillForm(oList.ID)
        txtName(0).SetFocus

Saving a record:
        oList.isnew = False  '-- See cancel code on why there should be an IsNew flag
        Call oList.Save

Cancelling an update:
        If oList.isnew Then
            Call oList.Delete(oList.ID)
            Call FillListbox
        Else
            Call FillForm(oList.ID)
        End If

Deleting a record:
        Call oList.Delete(oList.ID)
        If oList.MoveFirst Then
            Call FillForm(oList.ID)
        Else
            Call BlankForm
        End If

Filling the Data for a Combo Box:
        Call oTerms.FillList(cmbTerms) 

Changing the contents of text boxes:
Private Sub txtName_Change(Index As Integer)
    If bLoaded Then  '-- bLoaded is set after FillForm
        cmdName(1).Enabled = True  '-- Save enabled
        cmdName(2).Enabled = True  '-- Cancel enabled
        With oList
            Select Case Index
            Case 0
                .lname = txtName(0)
                bNameChange = True
            Case 1
                .fname = txtName(1)
                bNameChange = True
            Case 2: .address = txtName(2)
            Case 3: .city = txtName(3)
            Case 4: .state = txtName(4)
            Case 5: .zip = txtName(5)
            Case 6: .hphone = txtName(6)
            Case 7: .fax = txtName(7)
            Case 8: .ophone = txtName(8)
            Case 9: .ssno = txtName(9)
            Case 10: .notes = txtName(10)
            End Select
        End With
    End If
End Sub
