varConnection = "ODBC;DSN=CLD;UID=CLD;PWD=cld;APP=Microsoft Office 2003;WSID=SID14412" ';DATABASE A=CLD;TABLE=dbo.Data"'
With varConnection
.CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time" ''6/1/2010 00:00:00'"
.CommandText = "VALUES (VALKD, VALLow_Target, VALLow_LowerTol, VALLow_UpperTol, VALLow_Deflection, VALNom_Target, VALNom_LowerTol, VALNom_UpperTol, VALNom_Deflection, VALUpp_Target, VALUpp_LowerTol, VALUpp_UpperTol, VALUpp_Deflection, VALTolPercent, VALTol2N, VALTolInput, VALDate_Time"
.Name = "Query from 159.157.10_1"
.RefreshStyle = xlOverwriteCells
.Refresh BackgroundQuery:=False
End With
ASKER
With varConnection
.CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time) & _ ''6/1/2010 00:00:00'"
VALUES (" & VALKD & ", " & VALLow_Target & ", " & VALLow_LowerTol & ", " & VALLow_UpperTol & ", " & VALLow_Deflection & ", " & VALNom_Target & ", " & VALNom_LowerTol & ", " & VALNom_UpperTol & ", " & VALNom_Deflection & ", " & VALUpp_Target & ", " & VALUpp_LowerTol & ", " & VALUpp_UpperTol & ", " & VALUpp_Deflection & ", " & VALTolPercent", " & VALTol2N & ", " & VALTolInput & ", " & VALDate_Time & ")
.Name = "Query from 159.157.10_1"
.RefreshStyle = xlOverwriteCells
.Refresh BackgroundQuery:=False
End With
.CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time) & _ ''6/1/2010 00:00:00'"
" VALUES (" & VALKD & ", " & VALLow_Target & ", " & VALLow_LowerTol & ", " & VALLow_UpperTol & ", " & VALLow_Deflection & ", " & VALNom_Target & ", " & VALNom_LowerTol & ", " & VALNom_UpperTol & ", " & VALNom_Deflection & ", " & VALUpp_Target & ", " & VALUpp_LowerTol & ", " & VALUpp_UpperTol & ", " & VALUpp_Deflection & ", " & VALTolPercent", " & VALTol2N & ", " & VALTolInput & ", " & VALDate_Time & ")
ASKER
ASKER
Dim VALKD As String
Dim VALLow_Target As Single
Dim VALLow_LowerTol As Single
Dim VALLow_UpperTol As Single
Dim VALLow_Deflection As Single
Dim VALNom_Target As Single
Dim VALNom_LowerTol As Single
Dim VALNom_UpperTol As Single
Dim VALNom_Deflection As Single
Dim VALUpp_Target As Single
Dim VALUpp_LowerTol As Single
Dim VALUpp_UpperTol As Single
Dim VALUpp_Deflection As Single
Dim VALTolPercent As Single
Dim VALTol2N As Single
Dim VALTolInput As Single
Dim VALDate_Time As Date
VALKD = cboDIE_NO
VALLow_Target = txtLOWER
VALLow_LowerTol = txtLOWER_TOL_L
VALLow_UpperTol = txtUPPER_TOL_L
VALLow_Deflection = txtLOWER_DEF
VALNom_Target = txtNOMINAL
VALNom_LowerTol = txtLOWER_TOL_N
VALNom_UpperTol = txtUPPER_TOL_N
VALNom_Deflection = txtNOMINAL_DEF
VALUpp_Target = txtUPPER
VALUpp_LowerTol = txtLOWER_TOL_U
VALUpp_UpperTol = txtUPPER_TOL_U
VALUpp_Deflection = txtUPPER_DEF
VALTolPercent = chkTOL_PERCENT
VALTol2N = chkTOL_2N
VALTolInput = chkTOL_INPUT
VALDate_Time = Format(Now(), "m/d/yyyy h:mm AM/PM")
'Update table_name
'SET column1=value, column2=value2,...
'WHERE some_column = some_value
Sheets("CLD CURVES").Activate
For TOLCOLUMN = 1 To 200
If Sheets("CLD CURVES").Cells(1, TOLCOLUMN) = "KD_TOL" Then
If Sheets("CLD CURVES").Cells(2, TOLCOLUMN) = "" Then
GoTo ADDRECORD
Else:
GoTo UPDATERECORD
End If
End If
Next TOLCOLUMN
ADDRECORD:
varConnection = "ODBC;DSN=CLD;UID=CLD;PWD=cld;APP=Microsoft Office 2003;WSID=SID14412" ';DATABASE A=CLD;TABLE=dbo.Data"'
With varConnection
.CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time) VALUES('" & VALKD & "', '" & VALLow_Target & "', '" & VALLow_LowerTol & "', '" & VALLow_UpperTol & "', '" & VALLow_Deflection & "', '" & VALNom_Target & "', '" & VALNom_LowerTol & "', '" & VALNom_UpperTol & "', '" & VALNom_Deflection & "', '" & VALUpp_Target & "', '" & VALUpp_LowerTol & "', '" & VALUpp_UpperTol & "', '" & VALUpp_Deflection & "', '" & VALTolPercent & "', '" & VALTol2N & "', '" & VALTolInput & "', '" & VALDate_Time & "')"
'.Name = "Query from 159.157.10_1"
'.RefreshStyle = xlOverwriteCells
'.Refresh BackgroundQuery:=False
End With
ASKER
ASKER
ASKER
ASKER
Private Sub cmdCLD_CURVE_Click()
Dim Date_Time As Date
Dim SERIALNO As Single
Dim COLORID As Integer
Dim varConnection
COLORID = 1
Dim VALKD As String
Dim VALLow_Target As Single
Dim VALLow_LowerTol As Single
Dim VALLow_UpperTol As Single
Dim VALLow_Deflection As Single
Dim VALNom_Target As Single
Dim VALNom_LowerTol As Single
Dim VALNom_UpperTol As Single
Dim VALNom_Deflection As Single
Dim VALUpp_Target As Single
Dim VALUpp_LowerTol As Single
Dim VALUpp_UpperTol As Single
Dim VALUpp_Deflection As Single
Dim VALTolPercent As Single
Dim VALTol2N As Single
Dim VALTolInput As Single
Dim VALDate_Time As Date
VALKD = cboDIE_NO
VALLow_Target = txtLOWER
VALLow_LowerTol = txtLOWER_TOL_L
VALLow_UpperTol = txtUPPER_TOL_L
VALLow_Deflection = txtLOWER_DEF
VALNom_Target = txtNOMINAL
VALNom_LowerTol = txtLOWER_TOL_N
VALNom_UpperTol = txtUPPER_TOL_N
VALNom_Deflection = txtNOMINAL_DEF
VALUpp_Target = txtUPPER
VALUpp_LowerTol = txtLOWER_TOL_U
VALUpp_UpperTol = txtUPPER_TOL_U
VALUpp_Deflection = txtUPPER_DEF
VALTolPercent = chkTOL_PERCENT
VALTol2N = chkTOL_2N
VALTolInput = chkTOL_INPUT
VALDate_Time = Format(Now(), "m/d/yyyy h:mm AM/PM")
'Update table_name
'SET column1=value, column2=value2,...
'WHERE some_column = some_value
Sheets("CLD CURVES").Activate
For TOLCOLUMN = 1 To 200
If Sheets("CLD CURVES").Cells(1, TOLCOLUMN) = "KD_TOL" Then
If Sheets("CLD CURVES").Cells(2, TOLCOLUMN) = "" Then
GoTo ADDRECORD
Else:
GoTo UPDATERECORD
End If
End If
Next TOLCOLUMN
ADDRECORD:
varConnection = "ODBC;DSN=CLD;UID=CLD;PWD=cld;APP=Microsoft Office 2003;WSID=SID14412" ';DATABASE A=CLD;TABLE=dbo.Data"'
With varConnection
.CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time) VALUES('" & VALKD & "', '" & VALLow_Target & "', '" & VALLow_LowerTol & "', '" & VALLow_UpperTol & "', '" & VALLow_Deflection & "', '" & VALNom_Target & "', '" & VALNom_LowerTol & "', '" & VALNom_UpperTol & "', '" & VALNom_Deflection & "', '" & VALUpp_Target & "', '" & VALUpp_LowerTol & "', '" & VALUpp_UpperTol & "', '" & VALUpp_Deflection & "', '" & VALTolPercent & "', '" & VALTol2N & "', '" & VALTolInput & "', '" & VALDate_Time & "')"
'.Name = "Query from 159.157.10_1"
'.RefreshStyle = xlOverwriteCells
'.Refresh BackgroundQuery:=False
Debug.Print .CommandText
End With
Public Function InsertRates() As String
On Error GoTo InsertRates_ERROR:
Dim bFoundStartPoint As Boolean
Dim xlWS As Excel.Worksheet
Dim sReturn As String
Dim lCurrenciesAvailable As Long
Dim bOK As Boolean
Dim oConADODB As ADODB.Connection
Set oConADODB = New ADODB.Connection
oConADODB.ConnectionString = "driver=" & DSN_SQL_DRIVER & ";server=" & DSN_SQL_SERVER & ";uid=" & DSN_SQL_UID & ";pwd=" & DSN_SQL_LIVE_PWD & ";database=" & DSN_SQL_DATABASE & ";"
oConADODB.ConnectionTimeout = 30
oConADODB.Open
ASKER
ASKER
ASKER
ADDRECORD:
varConnection = "ODBC;DSN=CLD;UID=CLD;PWD=cld;APP=Microsoft Office 2003;WSID=SID14412" ';DATABASE A=CLD;TABLE=dbo.Data"'
Dim m_oConn As New ADODB.Connection
m_oConn.Open varConnection
With m_oConn
m_oConn.Execute ("INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time) VALUES('" & VALKD & "', '" & VALLow_Target & "', '" & VALLow_LowerTol & "', '" & VALLow_UpperTol & "', '" & VALLow_Deflection & "', '" & VALNom_Target & "', '" & VALNom_LowerTol & "', '" & VALNom_UpperTol & "', '" & VALNom_Deflection & "', '" & VALUpp_Target & "', '" & VALUpp_LowerTol & "', '" & VALUpp_UpperTol & "', '" & VALUpp_Deflection & "', '" & VALTolPercent & "', '" & VALTol2N & "', '" & VALTolInput & "', '" & VALDate_Time & "')")
'.Name = "Query from 159.157.10_1"
'.RefreshStyle = xlOverwriteCells
'.Refresh BackgroundQuery:=False
End With
m_oConn.Close
ASKER
ASKER
ASKER
ASKER
ASKER
ASKER
Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.
TRUSTED BY
With varConnection
.CommandText = "INSERT INTO CLDTolerances (KD_TOL, Low_Target, Low_LowerTol, Low_UpperTol, Low_Deflection, Nom_Target, Nom_LowerTol, Nom_UpperTol, Nom_Deflection, Upp_Target, Upp_LowerTol, Upp_UpperTol, Upp_Deflection, TolPercent, Tol2N, TolInput, Date_Time" & _
" VALUES (VALKD, VALLow_Target, VALLow_LowerTol, VALLow_UpperTol, VALLow_Deflection, VALNom_Target, VALNom_LowerTol, VALNom_UpperTol, VALNom_Deflection, VALUpp_Target, VALUpp_LowerTol, VALUpp_UpperTol, VALUpp_Deflection, VALTolPercent, VALTol2N, VALTolInput, VALDate_Time"
.Name = "Query from 159.157.10_1"
.RefreshStyle = xlOverwriteCells
.Refresh BackgroundQuery:=False
End With