Add the Public db as Database and the Public rs as Recordset to a module.

Then instead of having one of your forms as the Startup use a Sub Main. In this sub main you can add the code to SET the db and rs object just as you do in your forms. At the bottom of your Sub Main put in a call to startup your original startup form. This will allow all of your forms access to these objects.

You can add a module, put theese delaration in the general declaration area, then goto your project's property, change the startup item to Sub main. In for submain, add the open database code. then show your first form.

Featured Post

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.
There is also a companion Debug Toolbar that looks like the followin…

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…

Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code.
This l…