|
-
Jun 27th, 2000, 05:13 PM
#1
Thread Starter
Hyperactive Member
I have run in a bit of a problem because of this
Dim DB As Database
Dim rs As Recordset
Dim Apps As FileSystemObject
Set Apps = CreateObject("Scripting.FileSystemObject")
'set db location
Set DB = OpenDatabase(App.Path & "\configuration.mdb")
'Open the Contact table
Set rs = DB.OpenRecordset("SELECT netVESPAWeb.*, ISDefine.SetPreProccessor, altCarriers.Carrier FROM (ISDefine INNER JOIN netVESPAWeb ON ISDefine.ID = netVESPAWeb.ISPreProccessorType) INNER JOIN altCarriers ON netVESPAWeb.SetCarriers = altCarriers.ID", dbOpenDynaset)
I cannot decalre this globally, or can i any help please, i'm using mutiple functions that follow the record set and need them globally visible..?
Thanks in advance
-
Jun 28th, 2000, 04:36 AM
#2
Yeah don't understand why MS did this but
Ok MS use of Global variables is damn stupid....there got that off my chest....
Back to the question....
If you want to declare Global variables do it in a .bas routine. Generally add one to the project, and declare your globals in the general section at the top
Option Explict
Global rMyRecordset as Recordset
Global dbMyDatabase as Database
Private sPath as string
Forgot the name of the procedure to add to this but something like Sub Main....try it anyway
In this procedure
set all your global variables.
Now go to vbs drop down menu and select Project->Properties and the first tab.
Now on this window there is a drop down combo box called something like start or whatever, (sorry don't have vb at this site so am flying blind here.
Anyway it's the combo with the projects first form name in it. Click the down arrow and select Sub Main.
Ok this will initialise and declare your globals first when the projext/exe start. Call your main form or whatever from within Sub Main.
Hope that helps
-
Jun 28th, 2000, 08:22 AM
#3
Jethro's advice about creating global variables in a module is correct, but there is absolutely no need to use Sub Main or have it as your project's Statup Object. The Startup Object can reamin what ever it is today and it will work just fine.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|