I have a code as follows:
Dim strConnect As String
Dim strMsg As String
Dim db As Database
Dim tdfLocal As TableDef
Dim varTblArray As Variant
Dim varTblItem As Variant
Dim conn As ADODB.Connection
Dim rstmat As ADODB.Recordset
Dim strc As String
Dim count As Double
Set conn = New ADODB.Connection 'Define new ADO connection
Set rstmat = New ADODB.Recordset
counter = 1
strc = "DSN=ORATST0;UID=BLINK;DBQ=tst0;ASY=OFF;PWD=PASS"
With conn
.CursorLocation = adUseClient '
.ConnectionString = strc
.Open 'Open connection
End With
Set db = CurrentDb
'iterate throught the hard coded tables
varTblArray = Array("BUDLINK_SUPERVISOR"
For Each varTblItem In varTblArray
'reconnect
Set tdfLocal = db.TableDefs(CStr(varTblItem))
With tdfLocal
.Connect = conn
.RefreshLink
End With
Next varTblItem
End Sub
When it hits the .Refreshlink opens a window prompting me for DSN but DSN is already provided on line:
strc = "DSN=ORATST0;UID=BLINK;DBQ=tst0;ASY=OFF;PWD=PASS"
How can I getrid of it???? Please help its urgent. Thanks
Dim strConnect As String
Dim strMsg As String
Dim db As Database
Dim tdfLocal As TableDef
Dim varTblArray As Variant
Dim varTblItem As Variant
Dim conn As ADODB.Connection
Dim rstmat As ADODB.Recordset
Dim strc As String
Dim count As Double
Set conn = New ADODB.Connection 'Define new ADO connection
Set rstmat = New ADODB.Recordset
counter = 1
strc = "DSN=ORATST0;UID=BLINK;DBQ=tst0;ASY=OFF;PWD=PASS"
With conn
.CursorLocation = adUseClient '
.ConnectionString = strc
.Open 'Open connection
End With
Set db = CurrentDb
'iterate throught the hard coded tables
varTblArray = Array("BUDLINK_SUPERVISOR"
For Each varTblItem In varTblArray
'reconnect
Set tdfLocal = db.TableDefs(CStr(varTblItem))
With tdfLocal
.Connect = conn
.RefreshLink
End With
Next varTblItem
End Sub
When it hits the .Refreshlink opens a window prompting me for DSN but DSN is already provided on line:
strc = "DSN=ORATST0;UID=BLINK;DBQ=tst0;ASY=OFF;PWD=PASS"
How can I getrid of it???? Please help its urgent. Thanks