Home > SQL Server Tips > Database Development > VBA database class modules
SQL Server Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

DATABASE DEVELOPMENT

VBA database class modules


Barrie Sosinsky
08.01.2001
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


A Class module contains the definition for a new object. Procedures to represent the properties and methods of the object can be defined in the module. Class modules were available to Access developers first in the Access 97 database. The addition of standalone class modules in Visual Basic for Applications or VBA is a welcome site to users and would be developers. A class is the definition of an object. The module allows you to define the class or object. Once a class is defined, you can then create a new object simply by creating a new instance of the class.

While you may not be aware of it, you have probably used classes and associated objects already. As a brief example, the forms or reports modules you use are class modules, while the form or report itself is actually the instantiated object. Instantiated is when you create a new instance of a class, you create a new object, usually by using the set keyword, which assigns a variable to represent the new object. That is also a new occurrence of a class. Another good example of object definition and its instantiated result is the ComboBox class and a ComboBox object on your generated form.

Many times the same set of processes must be applied repeatedly whenever certain types of data are needed by your application. You can encapsulate your data combined with the rules and regulations that apply, and let less experienced developers have access to it without destroying or corrupting it. Since they are allowed only to reference the properties and methods, they do not go through entire pages of your code. Encapsulation preserves the integrity of your program.

Some of the best reasons for working with class modules are:

  • If you use the same types of forms, you can view multiple forms in separate windows.
  • If you have a multiuser environment and want to speed it up, you can create class modules that represent your records as reusable objects.
  • You can ensure that business rules are enforced, by encapsulating them and associated data into a single class.

More information about creating class modules is available at http://www.microsoft.com/officedev/articles/movs109.htm.

About the Author

Barrie Sosinsky (barries@killerapps.com) is president of consulting company Sosinsky and Associates (Medfield MA). He has written extensively on a variety of computer topics. His company specializes in custom software (database and Web related), training and technical documentation.

For More Information

  • What do you think about this tip? E-mail us at editor@searchDatabase.com with your feedback.
  • The Best VB Web Links: tips, tutorials, scripts, and more.
  • Have an VB tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
  • Ask your technical VB questions--or help out your peers by answering them--in our live discussion forums.
  • Check out our Ask the Experts feature: Our SQL, Database Design, Oracle, SQL Server, and DB2 gurus are waiting to answer your toughest questions.

Rate this Tip
To rate tips, you must be a member of SearchSQLServer.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
.NET Development for SQL Server
Creating Windows PowerShell scripts to manage SQL Server 2008 instances
Manipulate column names in a SQL Server table
Code to restore SQL Server databases in VB.NET
Custom VB.Net scripting in SQL Server Integration Services
Retrieve images from SQL Server and store in VB.Net
Connect to SQL Server database with Visual Basics
Top 10 SQL Server development questions
Developing CLR database objects: 10 tips, 10 minutes
CLR architecture
CLR stored procedures
.NET Development for SQL Server Research

Database Development
Using DELETE and TRUNCATE TABLE statements to delete data in SQL Server
Speed up reports in SQL Server Reporting Services with caching
Data Transformation Services vs. SSIS: The key differences
Working with IntelliSense in SQL Server 2008 Management Studio
Top tips and tricks for SQL Server database development
Managing the development lifecycle with Visual Studio Team System 2008
Processing XML files with SQL Server functions
A first look at Visual Studio Team System 2008 Database Edition
How to create a SQL inner join and outer join: Basics to get started
New datetime data types in SQL Server 2008 offer flexibility

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SQL Server Development - .NET, C#, T-SQL, Visual Basic
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts