Script Engineer
Script Engineer
With ews
.Workbooks.Open CurrentProject.Path & "\Daily well parameters\" &
FileString
.Visible = True
End With
With rst
.Open "DAI_WellParameter", cnn, adOpenKeyset, adLockOptimistic,
adCmdTableDirect
ews.Sheets(1).Select
k=1
j=1
DoTotal = ews.WorksheetFunction.CountA(ews.Range("C9:C999")) + 1
Do Until (k = DoTotal)
If Not IsEmpty(ews.Cells(j + 8, 3)) Then
.AddNew
.Fields("WH_Date").Value = FileCountr
.Fields("WH_Time").Value = ews.Cells(j + 8, 3)
If Not IsEmpty(ews.Cells(j + 8, 2)) Then
WellName = ews.Cells(j + 8, 2)
End If
.Fields("WH_WellID").Value = WellName
If IsEmpty(ews.Cells(j + 8, 4)) Or ews.Cells(j + 8, 4) = 0 Or Not
IsNumeric(ews.Cells(j + 8, 4)) Then
.Fields("WH_Choke").Value = 0
.Fields("WH_THP").Value = 0
.Fields("WH_THT").Value = 0
.Fields("WH_FLP").Value = 0
.Fields("WH_FLT").Value = 0
.Fields("WH_AAnnP").Value = 0
.Fields("WH_BAnnP").Value = 0
.Fields("WH_CAnnP").Value = 0
.Fields("WH_Scale").Value = 0
.Fields("WH_Corrs").Value = 0
.Fields("WH_Waxin").Value = 0
.Fields("WH_Dilut").Value = 0
Else
.Fields("WH_Choke").Value = ews.Cells(j + 8, 4)
.Fields("WH_THP").Value = ews.Cells(j + 8, 5)
.Fields("WH_THT").Value = ews.Cells(j + 8, 6)
.Fields("WH_FLP").Value = ews.Cells(j + 8, 7)
.Fields("WH_FLT").Value = ews.Cells(j + 8, 8)
.Fields("WH_AAnnP").Value = ews.Cells(j + 8, 9)
.Fields("WH_BAnnP").Value = ews.Cells(j + 8, 10)
.Fields("WH_CAnnP").Value = ews.Cells(j + 8, 11)
.Fields("WH_Scale").Value = ews.Cells(j + 8, 12)
.Fields("WH_Corrs").Value = ews.Cells(j + 8, 13)
.Fields("WH_Waxin").Value = ews.Cells(j + 8, 14)
.Fields("WH_Dilut").Value = ews.Cells(j + 8, 15)
End If
.Fields("WH_Commnt").Value = ews.Cells(j + 8, 16)
k=k+1
End If
j=j+1
Loop
.Save
.Close
End With
Next i
MsgBox "Well parameters database to updated to " & ReadToDate
ews.Quit
End If
End Function