Can you set lock mode settings in Excel. I have multiple ODBC queries that run and they seem to be conflicting with other insert queries from another program. We think it has to do with the database locking settings.
Is there a way I can manually set the lock settings in my ODBC connection in Excel?
Here is my existing code.
Set QT = WSW.QueryTables.Add(Connection:= _
"ODBC;DRIVER={Ingres};SERVER=" & Worksheets("QC").Range("E38").Value & ";DATABASE=" & Worksheets("QC").Range("E39").Value & ";SERVERTYPE=INGRES;UID="";PWD=""" _
, Destination:=Range("A1"))
With QT
.CommandText = Array( _
"SELECT ""WATER_LEVEL@T"".STATION_NO, ""WATER_LEVEL@T"".READING_DATE, ""WATER_LEVEL@T"".READING_VALUE" & Chr(13) & "" & Chr(10) & "FROM INGRES.""WATER_LEVEL@T"" ""WATER_LEVEL@T""" & Chr(13) & "" & Chr(10) & "WHERE (""WATER_LEVEL@T"".STATION_NO='" & Worksheets("QC").Range("E35").Value & "') AND (""WATER_LE" _
, _
"VEL@T"".READING_DATE>date('today')-date('" & Worksheets("QC").Range("E36").Value & " days'))" & Chr(13) & "" & Chr(10) & "ORDER BY ""WATER_LEVEL@T"".READING_DATE")
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xloverwritedelete
.SavePassword = True
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Is there a way I can manually set the lock settings in my ODBC connection in Excel?
Here is my existing code.
Set QT = WSW.QueryTables.Add(Connection:= _
"ODBC;DRIVER={Ingres};SERVER=" & Worksheets("QC").Range("E38").Value & ";DATABASE=" & Worksheets("QC").Range("E39").Value & ";SERVERTYPE=INGRES;UID="";PWD=""" _
, Destination:=Range("A1"))
With QT
.CommandText = Array( _
"SELECT ""WATER_LEVEL@T"".STATION_NO, ""WATER_LEVEL@T"".READING_DATE, ""WATER_LEVEL@T"".READING_VALUE" & Chr(13) & "" & Chr(10) & "FROM INGRES.""WATER_LEVEL@T"" ""WATER_LEVEL@T""" & Chr(13) & "" & Chr(10) & "WHERE (""WATER_LEVEL@T"".STATION_NO='" & Worksheets("QC").Range("E35").Value & "') AND (""WATER_LE" _
, _
"VEL@T"".READING_DATE>date('today')-date('" & Worksheets("QC").Range("E36").Value & " days'))" & Chr(13) & "" & Chr(10) & "ORDER BY ""WATER_LEVEL@T"".READING_DATE")
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xloverwritedelete
.SavePassword = True
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Code: