CPGDeveloper
Board Regular
- Joined
- Oct 8, 2008
- Messages
- 189
Hello,
So I administer and work on a db application -- Azure SQL Server Back End/MS Access Front End. I've been using ADODB Recordsets since we switched over to SQL Server, and will often write something like this:
Dim mysql as string
Dim myrs as New ADODB.Recordset
Dim myfield as string
mysql = "SELECT * FROM mytable;"
myrs.open mysql, CurrentProject.Connection
myfield = myrs.Fields(0)
myrs.close
Set myrs=Nothing
OR if the query is an action query, I will write something like:
CurrentProject.Connection.Execute mysql
My question is this syntax of 'CurrentProject.Connection' -- can it be put into some kind of global variable as it will always be the same throughout the project? or at least a variable within the subroutine?
So I administer and work on a db application -- Azure SQL Server Back End/MS Access Front End. I've been using ADODB Recordsets since we switched over to SQL Server, and will often write something like this:
Dim mysql as string
Dim myrs as New ADODB.Recordset
Dim myfield as string
mysql = "SELECT * FROM mytable;"
myrs.open mysql, CurrentProject.Connection
myfield = myrs.Fields(0)
myrs.close
Set myrs=Nothing
OR if the query is an action query, I will write something like:
CurrentProject.Connection.Execute mysql
My question is this syntax of 'CurrentProject.Connection' -- can it be put into some kind of global variable as it will always be the same throughout the project? or at least a variable within the subroutine?