Everytime I add a new form to my project and want to access a database, I have to declare it, and open it.
Dim db as database
db.opendatabase("..path..")
Is there any way I dont have to declare it in every form ?
Printable View
Everytime I add a new form to my project and want to access a database, I have to declare it, and open it.
Dim db as database
db.opendatabase("..path..")
Is there any way I dont have to declare it in every form ?
Use the Public statement to declare the db variable in the module section. Add new module to your project and place
Public db As Database
Variables declared using the Public statement are available to all procedures in all modules. You can open a database in any form.
------------------
smalig
[email protected]
http://vbcode.webhostme.com/
You also can open that database and recordset at the main form load event, so that you no need to open/close you database on each form you have created. :)
------------------
A free Man Stand on a free land.:cool:
[email protected]