frmsdz.frm
来自「VB与欧姆龙PLC通过RS-232串口通讯 的上位机程序」· FRM 代码 · 共 2,111 行 · 第 1/5 页
FRM
2,111 行
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方3"
Set lfrpt = dbrpt.OpenRecordset("lf3", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方4"
Set lfrpt = dbrpt.OpenRecordset("lf4", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方5"
Set lfrpt = dbrpt.OpenRecordset("lf5", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方6"
Set lfrpt = dbrpt.OpenRecordset("lf6", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方7"
Set lfrpt = dbrpt.OpenRecordset("lf7", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方8"
Set lfrpt = dbrpt.OpenRecordset("lf8", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方9"
Set lfrpt = dbrpt.OpenRecordset("lf9", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
Case Is = "配方10"
Set lfrpt = dbrpt.OpenRecordset("lf10", dbOpenDynaset)
If lfrpt.RecordCount > 0 Then
Text1.Text = lfrpt.Fields(2)
Text2.Text = lfrpt.Fields(3)
Text3.Text = lfrpt.Fields(4)
Text4.Text = lfrpt.Fields(5)
Text5.Text = lfrpt.Fields(6)
Text6.Text = lfrpt.Fields(7)
Text7.Text = lfrpt.Fields(8)
Text8.Text = lfrpt.Fields(9)
Text9.Text = lfrpt.Fields(10)
Text10.Text = lfrpt.Fields(11)
If temp = vbYes Then
lfrpt.Delete
lfrpt.Close
Set lfrpt = Nothing
MsgBox "配方数据删除成功!", vbExclamation + vbOKOnly, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Exit Sub
Else
Exit Sub
End If
Else
MsgBox "该配方没有设置数据,请选择其它配方!", vbExclamation + vbOKOnly, "信息提示"
Exit Sub
End If
End Select
End If
End Sub
Private Sub cmdsave_Click()
If Option1.Value And Combo1.Text = "" Then
MsgBox "请选择配方!", vbOKOnly + vbCritical, "错误"
Combo1.SetFocus
Exit Sub
End If
If Option1.Value And Combo1.Text = "配方1" Then
Text1.SetFocus
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MsgBox "设定值不能为空,请输入正确设定值 !", vbOKOnly + vbCritical, "错误"
Text1.SetFocus
Exit Sub
Else
Set lfrpt = dbrpt.OpenRecordset("lf1", dbOpenDynaset)
If lfrpt.RecordCount <> 0 Then
lfrpt.Delete
End If
lfrpt.AddNew
lfrpt.Fields(0) = Format(Now(), "yyyy-m-d")
lfrpt.Fields(1) = Format(Time(), "hh:mm")
lfrpt.Fields(2) = Trim(Text1.Text)
lfrpt.Fields(3) = Trim(Text2.Text)
lfrpt.Fields(4) = Trim(Text3.Text)
lfrpt.Fields(5) = Trim(Text4.Text)
lfrpt.Fields(6) = Trim(Text5.Text)
lfrpt.Fields(7) = Trim(Text6.Text)
lfrpt.Fields(8) = Trim(Text7.Text)
lfrpt.Fields(9) = Trim(Text8.Text)
lfrpt.Fields(10) = Trim(Text9.Text)
lfrpt.Fields(11) = Trim(Text10.Text)
lfrpt.Update
MsgBox "保存成功!", vbOKOnly + vbExclamation, "信息提示"
baocun = True
Exit Sub
End If
End If
If Option1.Value And Combo1.Text = "配方2" Then
Text1.SetFocus
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MsgBox "设定值不能为空,请输入正确设定值 !", vbOKOnly + vbCritical, "错误"
Text1.SetFocus
Exit Sub
Else
Set lfrpt = dbrpt.OpenRecordset("lf2", dbOpenDynaset)
If lfrpt.RecordCount <> 0 Then
lfrpt.Delete
End If
lfrpt.AddNew
lfrpt.Fields(0) = Format(Now(), "yyyy-m-d")
lfrpt.Fields(1) = Format(Time(), "hh:mm")
lfrpt.Fields(2) = Trim(Text1.Text)
lfrpt.Fields(3) = Trim(Text2.Text)
lfrpt.Fields(4) = Trim(Text3.Text)
lfrpt.Fields(5) = Trim(Text4.Text)
lfrpt.Fields(6) = Trim(Text5.Text)
lfrpt.Fields(7) = Trim(Text6.Text)
lfrpt.Fields(8) = Trim(Text7.Text)
lfrpt.Fields(9) = Trim(Text8.Text)
lfrpt.Fields(10) = Trim(Text9.Text)
lfrpt.Fields(11) = Trim(Text10.Text)
lfrpt.Update
MsgBox "保存成功!", vbOKOnly + vbExclamation, "信息提示"
baocun = True
Exit Sub
End If
End If
If Option1.Value And Combo1.Text = "配方3" Then
Text1.SetFocus
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MsgBox "设定值不能为空,请输入正确设定值 !", vbOKOnly + vbCritical, "错误"
Text1.SetFocus
Exit Sub
Else
Set lfrpt = dbrpt.OpenRecordset("lf3", dbOpenDynaset)
If lfrpt.RecordCount <> 0 Then
lfrpt.Delete
End If
lfrpt.AddNew
lfrpt.Fields(0) = Format(Now(), "yyyy-m-d")
lfrpt.Fields(1) = Format(Time(), "hh:mm")
lfrpt.Fields(2) = Trim(Text1.Text)
lfrpt.Fields(3) = Trim(Text2.Text)
lfrpt.Fields(4) = Trim(Text3.Text)
lfrpt.Fields(5) = Trim(Text4.Text)
lfrpt.Fields(6) = Trim(Text5.Text)
lfrpt.Fields(7) = Trim(Text6.Text)
lfrpt.Fields(8) = Trim(Text7.Text)
lfrpt.Fields(9) = Trim(Text8.Text)
lfrpt.Fields(10) = Trim(Text9.Text)
lfrpt.Fields(11) = Trim(Text10.Text)
lfrpt.Update
MsgBox "保存成功!", vbOKOnly + vbExclamation, "信息提示"
baocun = True
Exit Sub
End If
End If
If Option1.Value And Combo1.Text = "配方4" Then
Text1.SetFocus
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MsgBox "设定值不能为空,请输入正确设定值 !", vbOKOnly + vbCritical, "错误"
Text1.SetFocus
Exit Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?