請幫助...我已經成功地從Access 2000升級到2010然後到2016沒有編譯錯誤但是我有一個exe文件在VB代碼中的窗體中,不再運行或發送錯誤消息。該項目是一個地磅,已經在Access 2000上運行了15年或更長時間,並對設計進行了許多更改,其中exe文件從地秤「信號」箱捕獲數據並將其發送到我的表單。此exe不再適用於Access 2010(升級期間的程序)或Access 2016中。這對於該項目至關重要,我不再在VB中擁有原始代碼或在計算機上擁有VB副本,儘管我確實有複製原始程序員留下的文本文件。誰能告訴我爲什麼訪問2016年不承認這個EXE。是否有需要點擊的參考?我搞不清楚了。升級Access 2000到2010然後2016 VB問題
的代碼是
Private Sub Form_Load()
On Error GoTo Err_Form1
Select Case strDocName
Case "GetGrossWeight"
Set objFrmCtrl = Forms!ConsignmentsIN.GrossWeight
Warning.Caption = "Get Gross Weight In"
Case "GetTareWeight"
Set objFrmCtrl = Forms!ConsignmentsContractIN.TareWeight
Warning.Caption = "Get Tare Weight In"
Case "GetGrossWeightcontract"
Set objFrmCtrl = Forms!ConsignmentsContract.GrossWeight
Warning.Caption = "Get Gross Weight In"
Case "GetTareWeight"
Set objFrmCtrl = Forms!ConsignmentsContract.TareWeight
Warning.Caption = "Get Tare Weight In"
End Select
OpenEXE
Exit_Form2:
Exit Sub
Err_Form1:
MsgBox Error$
Resume Exit_Form2
End Sub
Private Sub OpenEXE()
On Error Resume Next
GrossValue = Shell("c:\weighbr\auto\Weight.exe", 6)
If Err.Number = 53 And GrossValue = 0 Then
MsgBox "Can't find program 'Weight.exe'", vbInformation, "Alert"
End If
' ...
End Sub
你的意思是「在表單中有一個exe文件」? – joanolo
感謝您的回覆,這是觸發exe的事件過程。 – Izzy
設置objFrmCtrl =形式ConsignmentsContract.TareWeight Warning.Caption = 「獲取皮重出」 Box54.BackColor = vbRed 最終選擇 OpenEXE Exit_Form2: 退出小組 Err_Form1: MSGBOX錯誤$ 恢復Exit_Form2 結束小組 Private Sub OpenEXE() On Error Resume Next GrossValue = Shell(「c:\ weighbr \ auto \ Weight.exe」,6) If Err.Number = 53 And GrossValue = 0 Then MsgBox「Can not find程序'Weight.exe'「,vbInformation,」Alert「 End If – Izzy