VB运行报错75
Public Sub SaveInfos(Frm As Form)
With Frm
Dim dbRecordset As New ADODB.Recordset
If .LngCurMode = 2 Or .LngCurMode = 3 Or .LngCurMode = 4 Then
dbRecordset.Open "select * FROM 主数据表 where id=" & .LngCurId, db, 1, 3
ElseIf .LngCurMode = 1 Then
dbRecordset.Open "select * FROM 主数据表", db, 1, 3
dbRecordset.AddNew
End If
Dim vItem, TmpStr As String
For Each vItem In .Controls
If TypeOf vItem Is TextBox Then
If vItem.Name <> "TxtModel" Then
dbRecordset.Fields(vItem.Tag) = vItem.Text & ""
End If
End If
Next
dbRecordset.Fields("设备类型") = .StrCurType
dbRecordset.Fields("设备名称") = .StrCurName
dbRecordset.Fields("规格型号") = .TxtModel.Text
Dim TempDrawingName As String, NewDrawingName As String
TempDrawingName = App.Path & "\Drawings\0.dwg"
If Dir(TempDrawingName) <> "" Then
If .LngCurMode = 1 Then
NewDrawingName = App.Path & "\Drawings" & dbRecordset.Fields("ID").Value & ".dwg"
Else
NewDrawingName = App.Path & "\Drawings" & Frm.LngCurId & ".dwg"
End If
If Dir(NewDrawingName) <> "" Then
Kill NewDrawingName '该行报错,用msgbox NewDrawingName能正确显示文件路径
End If
Name TempDrawingName As NewDrawingName
End If
dbRecordset.Update
dbRecordset.Close
Set dbRecordset = Nothing
FrmMain.ReloadSheet
Unload Frm
End With
If FrmMain.CombModel.Text = "" Then
FrmMain.ComName_Click
End If
End Sub
求解答!
不好意思,分不够 只能发这儿了!
[解决办法]
ESK有可能NewDrawingName这个文件处于打开状态?