'Write Invoice Data records
Set rst1 = New ADODB.Recordset
rst1.Open "tbl_InvoiceData", conn, , adLockOptimistic
rst1.AddNew
rst1("InvoiceID") = strInvoiceID
rst1("SalesOrderNumber") = Me.txtSONumber
rst1("ReleaseNumber") = Me.txtRelNumber
strPO = Trim(sess0.Screen.getstring(3, 41, 30))
StripString (strPO)
strPO = strHoldString
rst1("CustomerPONumber") = strPO
rst1("LineNumber") = ""
rst1("Qty") = Trim(sess0.Screen.getstring(23, 16, 7))
rst1("ItemNumber") = Trim(sess0.Screen.getstring(20, 9, 25))
rst1("ItemDescription") = ""
rst1("UnitValue") = Trim(sess0.Screen.getstring(20, 40, 13))
rst1("ExtendedPrice") = Trim(sess0.Screen.getstring(21, 70, 11))
'Get external data
'Call ExternalData
rst1("HarmonicCode") = ""
rst1("HarmonicDescription") = ""
rst1("CountryofOrigin") = ""
rst1.Update
'Check for "MORE" invoice data records
strTest = Trim(sess0.Screen.getstring(2, 62, 4))
If strTest = "MORE" Then
intMore = 1
w = 1
200
X = 7
sess0.Screen.SendKeys ("")
sess0.Screen.WaitForCursor 2, 14
sess0.Screen.SendKeys (" ")
sess0.Screen.WaitForCursor 2, 15
For i = 1 To 3
'Add new item
strTest = Trim(sess0.Screen.getstring(X, 9, 25))
'If IsNull(strTest) Then
If strTest = "" Then
Exit For
End If
rst1.AddNew
rst1("InvoiceID") = strInvoiceID
rst1("SalesOrderNumber") = Me.txtSONumber
rst1("ReleaseNumber") = Me.txtRelNumber
rst1("CustomerPONumber") = strPO
rst1("LineNumber") = ""
rst1("Qty") = Trim(sess0.Screen.getstring((X + 3), 16, 7))
rst1("ItemNumber") = Trim(sess0.Screen.getstring(X, 9, 25))
rst1("ItemDescription") = ""
rst1("UnitValue") = Trim(sess0.Screen.getstring(X, 40, 13))
rst1("ExtendedPrice") = Trim(sess0.Screen.getstring((X + 1), 70, 11))
'Get external data
'Call ExternalData
rst1("HarmonicCode") = ""
rst1("HarmonicDescription") = ""
rst1("CountryofOrigin") = ""
rst1.Update
X = X + 5
Next i
strTest = Trim(sess0.Screen.getstring(2, 62, 4))
If strTest = "MORE" Then
GoTo 200
End If
End If
Else
MsgBox "There is no data to scrape." & vbCrLf & " " & vbCrLf & "Please check to see if you've entered the correct sales order info."
End If
sess0.Screen.SendKeys ("")
'Pause and requery
For intWait = 1 To 3000
DoEvents
Next intWait
Me.sub1.Requery
rst1.Close
conn.Close
|