📄 form8.frm
字号:
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim v1, w1, x1, y1, z1, a2, b2 As String
Dim str As String
Private Sub Command1_Click()
'Text1.Text = ""
'Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
End Sub
Private Sub Command2_Click()
'Dim db As Database
'Dim rec As Recordset
'Set db = OpenDatabase(App.Path + "\wfk-03.mdb")
'Set rec = db.OpenRecordset("dianyuan")
'rec.AddNew
'rec!电源型号 = Text1
'rec.Fields("电源编号") = Text2
'输入电压220
'rec!工频耐压 = Text3
'rec!过压保护 = Text4
'rec!V17 = Text5
'rec!V14 = Text6
'rec!V22 = Text7
'rec!V305 = Text8
'rec!V403 = Text9
'rec!备注 = Text10
'输入电压110
'rec!工频耐压Z = Text11
'rec!过压保护Z = Text12
'rec!V17Z = Text13
'rec!V14Z = Text14
'rec!V22Z = Text15
'rec!V305Z = Text16
'rec!V403Z = Text17
'rec!备注Z = Text18
'rec!检验员 = Text19
'rec!检验日期 = Text20
'rec.Update
If Text2.Text = "" Then
z1 = MsgBox("请输入删除编号", 0, "提示")
Else
Dim db As Database
Dim rec As Recordset
Set db = OpenDatabase(App.Path + "\wfk-03.mdb")
Set rec = db.OpenRecordset("select * from dianyuan where 电源编号 ='" & Text2.Text & " ' ")
If rec.RecordCount > 0 Then
a2 = MsgBox("确定要删除该记录", 4, "提示")
If a2 = 6 Then
'Dim db1 As Database
'Dim rec1 As Recordset
'Set db1 = OpenDatabase(App.Path + "\wfk-03.mdb")
'Set rec1 = db1.OpenRecordset("diantai")
db.Execute ("delete * from dianyuan where 电源编号 ='" & Text2.Text & " ' ")
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
Else
End If
Else
'Text1.Text = ""
'Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
b2 = MsgBox("编号不存在,请输入要删除的编号", 0, "提示")
End If
rec.Close
Set rec = Nothing
End If
End Sub
Private Sub Command3_Click()
Dim db As Database
Dim rec As Recordset
Set db = OpenDatabase(App.Path + "\wfk-03.mdb")
Set rec = db.OpenRecordset("select * from dianyuan where 电源编号 = '" & Text2.Text & " ' ")
If Text2.Text = "" Then
v1 = MsgBox("请输入查询编号", 0, "提示")
Else
If rec.RecordCount > 0 Then
Text1.Text = gfNullToString(rec.Fields("电源型号"))
Text2.Text = gfNullToString(rec.Fields("电源编号"))
Text3.Text = gfNullToString(rec.Fields("工频耐压"))
Text4.Text = gfNullToString(rec.Fields("过压保护"))
Text5.Text = gfNullToString(rec.Fields("V17"))
Text6.Text = gfNullToString(rec.Fields("V14"))
Text7.Text = gfNullToString(rec.Fields("V22"))
Text8.Text = gfNullToString(rec.Fields("V305"))
Text9.Text = gfNullToString(rec.Fields("V403"))
Text10.Text = gfNullToString(rec.Fields("备注"))
Text11.Text = gfNullToString(rec.Fields("工频耐压Z"))
Text12.Text = gfNullToString(rec.Fields("过压保护Z"))
Text13.Text = gfNullToString(rec.Fields("V17Z"))
Text14.Text = gfNullToString(rec.Fields("V14Z"))
Text15.Text = gfNullToString(rec.Fields("V22Z"))
Text16.Text = gfNullToString(rec.Fields("V305Z"))
Text17.Text = gfNullToString(rec.Fields("V403Z"))
Text18.Text = gfNullToString(rec.Fields("备注Z"))
Text19.Text = gfNullToString(rec.Fields("检验员"))
Text20.Text = gfNullToString(rec.Fields("检验日期"))
Else
'Text1.Text = ""
'Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
w1 = MsgBox("序号不存在,请重新输入", 0, "提示")
End If
End If
rec.Close
Set rec = Nothing
End Sub
Private Sub Command4_Click()
Dim db As Database
Dim rec As Recordset
Set db = OpenDatabase(App.Path + "\wfk-03.mdb")
Set rec = db.OpenRecordset("select 电源编号 from dianyuan where 电源编号 = '" & Text2.Text & " ' ")
If Text2.Text = "" Then
x1 = MsgBox("请输入编号", 0, "提示")
Else
If rec.RecordCount = 0 Then
str = "insert into dianyuan ("
str = str & "电源型号,电源编号,工频耐压,过压保护,V17,V14,V22,V305,V403,备注,工频耐压Z,"
str = str & "过压保护Z,V17Z,V14Z,V22Z,V305Z,V403Z,备注Z,检验员,检验日期"
str = str & ")"
str = str & " values("
str = str & "'" & Text1.Text & "',"
str = str & "'" & Text2.Text & "',"
str = str & "'" & Text3.Text & "',"
str = str & "'" & Text4.Text & "',"
str = str & "'" & Text5.Text & "',"
str = str & "'" & Text6.Text & "',"
str = str & "'" & Text7.Text & "',"
str = str & "'" & Text8.Text & "',"
str = str & "'" & Text9.Text & "',"
str = str & "'" & Text10.Text & "',"
str = str & "'" & Text11.Text & "',"
str = str & "'" & Text12.Text & "',"
str = str & "'" & Text13.Text & "',"
str = str & "'" & Text14.Text & "',"
str = str & "'" & Text15.Text & "',"
str = str & "'" & Text16.Text & "',"
str = str & "'" & Text17.Text & "',"
str = str & "'" & Text18.Text & "',"
str = str & "'" & Text19.Text & "',"
str = str & "'" & Text20.Text & "'"
str = str & ") "
db.Execute (str)
Else
y1 = MsgBox("是否覆盖以前的记录", 4, "提示")
If y1 = 6 Then
Set rec = db.OpenRecordset("select * from dianyuan where 电源编号 = '" & Text2.Text & " ' ")
db.Execute "update dianyuan set 电源型号 = '" & Text1.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
'220
db.Execute "update dianyuan set 工频耐压 = '" & Text3.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set 过压保护 = '" & Text4.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V17 = '" & Text5.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V14 = '" & Text6.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V22 = '" & Text7.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V305 = '" & Text8.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V403 = '" & Text9.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set 备注 = '" & Text10.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
'110
db.Execute "update dianyuan set 工频耐压Z = '" & Text11.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set 过压保护Z = '" & Text12.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V17Z = '" & Text13.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V14Z = '" & Text14.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V22Z = '" & Text15.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V305Z = '" & Text16.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set V403Z = '" & Text17.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set 备注Z = '" & Text18.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set 检验员 = '" & Text19.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
db.Execute "update dianyuan set 检验日期 = '" & Text20.Text & " ' where 电源编号 = '" & rec.Fields("电源编号") & "'"
Else
End If
End If
End If
'Text1.Text = ""
'Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
rec.Close
Set rec = Nothing
End Sub
Private Sub Command5_Click()
'Text1.Text = ""
'Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
End Sub
Private Sub Command6_Click()
Unload Me
Form1.Show
'Form1.Show
'Form8.Visible = False
'Text1.Text = ""
'Text2.Text = ""
'Text3.Text = ""
'Text4.Text = ""
'Text5.Text = ""
'Text6.Text = ""
'Text7.Text = ""
'Text8.Text = ""
'Text9.Text = ""
'Text10.Text = ""
'Text11.Text = ""
'Text12.Text = ""
'Text13.Text = ""
'Text14.Text = ""
'Text15.Text = ""
'Text16.Text = ""
'Text17.Text = ""
'Text18.Text = ""
'Text19.Text = ""
'Text20.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
Form1.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -