S
Simon Niederberger
Hi all
I have the code posted below in the startup routine of my ADP (Access 2000 +
MSDE). When no initial connection is found and the OLE Connection Dialog
comes up, the connection might afterwards be established, but the new
connection property is not saved to the ADP. Thus, when I close and reopen
the ADP, the old connection string is still in there.
Shouldn't Application.CurrentProject.OpenConnection set the
BaseConnectionString?
Thanks
Simon
If CurrentProject.IsConnected Then
DoCmd.OpenForm "fMainForm"
Else
Set lnk = New MSDASC.DataLinks
Set oConn = New ADODB.Connection
oConn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=False;" & _
"Data Source=localhost;User ID=sa;Initial Catalog=LaTrack;"
good = lnk.PromptEdit(oConn)
oConn.ConnectionTimeout = 5
On Error Resume Next
oConn.Open
On Error GoTo 0
'Set oConn = lnk.PromptNew
If oConn.State = adStateOpen Then
connStr = oConn.ConnectionString
oConn.Close
Set oConn = Nothing
Set lnk = Nothing
'Application.CurrentProject.CloseConnection
Application.CurrentProject.OpenConnection connStr
Else
DoCmd.Quit
End If
End If
I have the code posted below in the startup routine of my ADP (Access 2000 +
MSDE). When no initial connection is found and the OLE Connection Dialog
comes up, the connection might afterwards be established, but the new
connection property is not saved to the ADP. Thus, when I close and reopen
the ADP, the old connection string is still in there.
Shouldn't Application.CurrentProject.OpenConnection set the
BaseConnectionString?
Thanks
Simon
If CurrentProject.IsConnected Then
DoCmd.OpenForm "fMainForm"
Else
Set lnk = New MSDASC.DataLinks
Set oConn = New ADODB.Connection
oConn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=False;" & _
"Data Source=localhost;User ID=sa;Initial Catalog=LaTrack;"
good = lnk.PromptEdit(oConn)
oConn.ConnectionTimeout = 5
On Error Resume Next
oConn.Open
On Error GoTo 0
'Set oConn = lnk.PromptNew
If oConn.State = adStateOpen Then
connStr = oConn.ConnectionString
oConn.Close
Set oConn = Nothing
Set lnk = Nothing
'Application.CurrentProject.CloseConnection
Application.CurrentProject.OpenConnection connStr
Else
DoCmd.Quit
End If
End If