M
Molasses26
I know I've seen an explanation of this somewhere but I can't, for the life
of me, find it again now that I need it!
I have an Access front-end app attached to tables on a SQL server and I have
set up a number of functions to execute pass-through queries and stuff. What
I need is a way to change all the connection strings when I switch from
Developement to Production environments.
Switching between "DSN=BillingServicesDSN" and "DSN=BillingServicesProdDSN"
It wasn't too bad when I just had one or two but it's getting a little
out-of-hand now and I need to clean this up.
Thanks!
Here is an example of one of the functions:
Public Function ExecAgingReport(datToDate As String, datFromDate As String)
Dim db As Database
Dim qd As QueryDef
Set db = CurrentDb ' Setting the database as current Database
db.QueryDefs.Delete ("spr_AgingReport") 'deleting the old defination of
pass-through query
Set qd = db.CreateQueryDef("spr_AgingReport") 'define new query defination
qd.ReturnsRecords = True ' Query does retrieve records
qd.Connect = "ODBC;DSN=BillingServicesDSN"
qd.SQL = "Exec spr_AgingReport " & "'" & datToDate & "'" & ", " & "'" &
datFromDate & "'"
qd.ReturnsRecords = True ' Query does retrieve records
qd.Close
End Function
of me, find it again now that I need it!
I have an Access front-end app attached to tables on a SQL server and I have
set up a number of functions to execute pass-through queries and stuff. What
I need is a way to change all the connection strings when I switch from
Developement to Production environments.
Switching between "DSN=BillingServicesDSN" and "DSN=BillingServicesProdDSN"
It wasn't too bad when I just had one or two but it's getting a little
out-of-hand now and I need to clean this up.
Thanks!
Here is an example of one of the functions:
Public Function ExecAgingReport(datToDate As String, datFromDate As String)
Dim db As Database
Dim qd As QueryDef
Set db = CurrentDb ' Setting the database as current Database
db.QueryDefs.Delete ("spr_AgingReport") 'deleting the old defination of
pass-through query
Set qd = db.CreateQueryDef("spr_AgingReport") 'define new query defination
qd.ReturnsRecords = True ' Query does retrieve records
qd.Connect = "ODBC;DSN=BillingServicesDSN"
qd.SQL = "Exec spr_AgingReport " & "'" & datToDate & "'" & ", " & "'" &
datFromDate & "'"
qd.ReturnsRecords = True ' Query does retrieve records
qd.Close
End Function