Code works with 32 bit systems, but do not work with 64-bit. what can I do?
When i click macro, then displays a message "I can't connect to the server - General ODBC Error".
On Error Resume Next
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;Driver={Microsoft ODBC for driver};UID=" + liet + ";PWD=" + passw + ";SERVER=" + serv + ";", Destination:=Workbooks(rezultata_fails).Sheets(rez_lapas_nos).Cells(6, 1))
.Sql = sql_teksts
.FieldNames = False
.RefreshStyle = xlOverwriteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = False
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SavePassword = False
.SaveData = True
End With
If Err.Number <> 0 Then
If Err.Description = "SQL Syntax Error" Then 'Or Err.Description = "General ODBC Error" Then
MsgBox "Sintaktiska kļūda datu atlases SQL vaicājumā!" & Chr(13) & Chr(13) & "Kļūdas kods: " & Err.Number & Chr(13) & "Kļūdas apraksts: " & Err.Description, vbCritical, "Kļūda"
Workbooks(koda_fails).Sheets("Parametri").Cells(i, 2) = "Sintaktiska kļūda datu atlases SQL vaicājumā!"
Err.Clear
Exit Sub
Else
MsgBox "Kļūda datu atlasē pieslēdzoties serverim!" & Chr(13) & Chr(13) & "Kļūdas kods: " & Err.Number & Chr(13) & "Kļūdas apraksts: " & Err.Description, vbCritical, "Kļūda"
Workbooks(koda_fails).Sheets("Parametri").Cells(i, 2) = "Kļūda datu atlasē!"
Err.Clear
Exit Sub
End If
End If
When i click macro, then displays a message "I can't connect to the server - General ODBC Error".
On Error Resume Next
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;Driver={Microsoft ODBC for driver};UID=" + liet + ";PWD=" + passw + ";SERVER=" + serv + ";", Destination:=Workbooks(rezultata_fails).Sheets(rez_lapas_nos).Cells(6, 1))
.Sql = sql_teksts
.FieldNames = False
.RefreshStyle = xlOverwriteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = False
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SavePassword = False
.SaveData = True
End With
If Err.Number <> 0 Then
If Err.Description = "SQL Syntax Error" Then 'Or Err.Description = "General ODBC Error" Then
MsgBox "Sintaktiska kļūda datu atlases SQL vaicājumā!" & Chr(13) & Chr(13) & "Kļūdas kods: " & Err.Number & Chr(13) & "Kļūdas apraksts: " & Err.Description, vbCritical, "Kļūda"
Workbooks(koda_fails).Sheets("Parametri").Cells(i, 2) = "Sintaktiska kļūda datu atlases SQL vaicājumā!"
Err.Clear
Exit Sub
Else
MsgBox "Kļūda datu atlasē pieslēdzoties serverim!" & Chr(13) & Chr(13) & "Kļūdas kods: " & Err.Number & Chr(13) & "Kļūdas apraksts: " & Err.Description, vbCritical, "Kļūda"
Workbooks(koda_fails).Sheets("Parametri").Cells(i, 2) = "Kļūda datu atlasē!"
Err.Clear
Exit Sub
End If
End If