问题描述
我设计了一个表格来从我的公司网页中提取日期,我可以更改日期,然后它会更新我公司页面中的日期。这就像一个魅力。 如果我按下按钮来检索相同的信息,则显示的日期将是旧日期,而不是新日期。我检查了网页,日期已经到位。如果我关闭 Access 并重新打开它,并验证日期,则它只会显示我所做的更改。
我错过了什么?
Sub tbl50_UpdateModemDates() 'Retrieve the modem listed in the table and update the Delivery date,keeps the difference days between Preconfig,Loadout and Deliver dates
Dim HTMLDoc As New MSHTML.HTMLDocument
Dim HTMLBody As MSHTML.HTMLBody
Dim URL As String
Set HTMLDoc = New MSHTML.HTMLDocument
Set HTMLBody = HTMLDoc.body
Dim ModemStatus As String
Dim MyRTBL50 As Recordset
Const GETModemURL = "http://tanwebs.corp.halliburton.com/pls/log_web/mobssus_vieword$order_mc.QueryViewByKey?P_SSORD_ID="
Set MyRTBL50 = CurrentDb.OpenRecordset("tbl50_UpdateModemDateAutomatically",dbOpenDynaset)
'Empty the table,keep the modem number only
btnEmptyTable_Click
While MyRTBL50.EOF = False
ModemNr = MyRTBL50![ModemNr]
URL = GETModemURL + ModemNr
HTMLDoc.body.innerHTML = RetrieveModemViagetmethod(URL)
ModemStatus = HTMLBody.getElementsByTagName("table")(0).getElementsByTagName("tr")(19).getElementsByTagName("td")(1).innerText
MyRTBL50.Edit
If ModemStatus = "Activated" Or ModemStatus = "Not Activated" Or ModemStatus = "Ready" Then 'Retrive the data for each colum
'Set maintable = HTMLBody.getElementsByTagName("table").Item(0)
'Set trcollection = maintable.getElementsByTagName("TR")
Set trcollection = HTMLBody.getElementsByTagName("table").Item(0).getElementsByTagName("TR")
For Each tditem In trcollection
Select Case tditem.getElementsByTagName("TD")(0).innerText
Case "Sales Order:"
'ZSPO
MyRTBL50![ZSPO] = tditem.firstChild.nextSibling.innerText
Case "Rig Name:"
'RigName
MyRTBL50![Rig] = tditem.firstChild.nextSibling.innerText
Case "Well Number:"
'WellName
MyRTBL50![Well] = tditem.firstChild.nextSibling.innerText
Case "Well Section:"
'Section Size
MyRTBL50![Section] = tditem.firstChild.nextSibling.innerText
Case "Pre Config Date:"
'Preconfig
'MyRTBL50![PreConfigDate] = tditem.getElementsByTagName("TD")(1).firstChild.Value
MyRTBL50![PreConfigDate] = HTMLDoc.getElementById("P_DATE_LOAD").Value
a = HTMLDoc.getElementById("P_DATE_LOAD").Value
Case "Loadout Date:"
'Loadoutdate
MyRTBL50![LoadOutDate] = tditem.firstChild.nextSibling.innerText
Case "Deliver To Customer:"
MyRTBL50![DeliveryDate] = tditem.firstChild.nextSibling.innerText
End Select
If ModemStatus = "Ready" Then
MyRTBL50![Comment] = "Modem Ready. Changes are not allowed."
End If
Next
Else
MyRTBL50![Comment] = "Skipped: modem already completed or canceled."
End If
MyRTBL50.Update
MyRTBL50.MoveNext
Refresh
Wend
MyRTBL50.Close
Set MyRTBL50 = nothing
Set HTMLDoc = nothing
Set HTMLBody = nothing
End Sub
以及表单的可视化。应该正确显示的值是中间的 3 个日期,在它们更新后,我单击按钮检索调制解调器日期。
谢谢! 塞尔吉奥
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)