Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Function tst()
'MsgBox ("REMEMBER TO CHANGE CONNECTION DEFAULT DBFORMAT BEFORE CONVERSION!!!!")
Call ReconnectDatabase("CentralProofOH ", "OHCLESQL1001")
'Call ReconnectDatabase("CentralProofTE", "(LOCAL)")
End Function
Public Function ReconnectDatabase(strDbName As String, strServerName As String)
'On Error GoTo Reconnect_Err
Call fUpdatePassThroughQueryConnection(strDbName, strServerName)
Call fChangeTblConnectString(strDbName, strServerName)
MsgBox ("Finished reconnecting database tables and passthrough queries.")
Exit Function
Reconnect_Err:
MsgBox "The Connection Process was interupted. You need to compact and repair this database before attempting to reconnect.", vbCritical
End Function
Private Function fUpdatePassThroughQueryConnection(str_DBName As String, str_Server)
Dim i As Integer
Dim s As New clsStatusBar
s.Steps = CurrentDb.QueryDefs.Count
s.MeterText = "Linking Queries"
For i = 0 To CurrentDb.QueryDefs.Count - 1
s.MoveMeterBar
If (Len(CurrentDb.QueryDefs(i).Connect) > 1) Then
CurrentDb.QueryDefs(i).Connect = "ODBC;driver={SQL Server};server=" & str_Server & ";" & _
"database=" & str_DBName & ";" & "Trusted_Connection=Yes;" '"ODBC;DSN=" & DSN & ";Description=Central Proof Databases;DATABASE=" & DbName & ";Network=DBMSSOCN;Trusted_Connection=Yes"
End If
CurrentDb.QueryDefs(i).ODBCTimeout = 600
Next i
s.ClearBar
End Function
Public Function fChangeTblConnectString(str_DBName As String, str_Server)
'This sample function changes the connect string of the linked SQL Server
'Events database to be DSN-less.
On Error GoTo TblCnt_Err
Dim db As DATABASE
Dim t As TableDef
Dim int_error As Integer
Dim s As New clsStatusBar
s.Steps = CurrentDb.TableDefs.Count
s.MeterText = "Linking Tables"
'added "Network Library=dbmssocn;" for this to use TCP/IP
Set db = CurrentDb
For Each t In db.TableDefs
s.MoveMeterBar
If t.Attributes And dbAttachedODBC Then
t.Connect = "driver={SQL Server};server=" & str_Server & ";" & _
"database=" & str_DBName & ";" & "Trusted_Connection=Yes;" & "Network Library=DBMSSOCN;"
t.RefreshLink
End If
Next
db.Close
s.ClearBar
If int_error > 0 Then
MsgBox ("There were " & int_error & " errors during reconnection of tables.")
End If
Exit Function
TblCnt_Err:
int_error = int_error + 1
End Function
I'm still missing the point. What exactly is this "ad-hoc rpoerting that is built on the fly" that can be done in MDBs but not ADPs? You can't mean the GUI part of MDBs that can create true passthrough queries because that wouldn't be programmatic using RegExps or whatever. And what other way is there to do server-side queries if you don't use VB? Have you thought about using the SQLDMO object? Maybe I'm getting hung up on the word passthrough. What do you mean by that?hwkranger said:1) You can not use PASS-THROUGH Queries on the fly was my point. You can of course use a rst at anytime with VB. Sometimes It's nice to have ad-hoc reporting that is built on the fly (using RegX or any number of string manipulations)
2) Of course Performance is going to be better with an ADP since, ADP's use the server side record handling much more efficient. But then, if that's the point -- Why not use C# or VB.Net. Why even both with Access? Aside from the "reports" part, there is no gain...