MsgBox "请输入仪器名称!", vbOKOnly + vbExclamation, "信息提示"
txtyqmc.SetFocus
Exit Sub
End If
If Trim(txtxh.Text) = "" Then
MsgBox "请输入仪器型号!", vbOKOnly + vbExclamation, "信息提示"
txtxh.SetFocus
Exit Sub
End If
If Trim(txtgg.Text) = "" Then
MsgBox "请输入规格!", vbOKOnly + vbExclamation, "信息提示"
txtgg.SetFocus
Exit Sub
End If
If Trim(txtdj.Text) = "" Then
MsgBox "请输入仪器单价!", vbOKOnly + vbExclamation, "信息提示"
txtdj.SetFocus
Exit Sub
End If
If Trim(txtcj.Text) = "" Then
MsgBox "请输入厂家!", vbOKOnly + vbExclamation, "信息提示"
txtcj.SetFocus
Exit Sub
End If
If Trim(txtgzrq.Text) = "" Then
MsgBox "请输入购置日期!", vbOKOnly + vbExclamation, "信息提示"
txtgzrq.SetFocus
Exit Sub
End If
If Trim(txtxz.Text) = "" Then
MsgBox "请输入现状!", vbOKOnly + vbExclamation, "信息提示"
txtxz.SetFocus
Exit Sub
End If
If Trim(txtlyr.Text) = "" Then
MsgBox "请输入领用人!", vbOKOnly + vbExclamation, "信息提示"
txtlyr.SetFocus
Exit Sub
End If
If Trim(txtjsr.Text) = "" Then
MsgBox "请输入经手人!", vbOKOnly + vbExclamation, "信息提示"
txtjsr.SetFocus
Exit Sub
End If
If Trim(txtrksj.Text) = "" Then
MsgBox "请输入rksj!", vbOKOnly + vbExclamation, "信息提示"
txtrksj.SetFocus
Exit Sub
End If
rstxinxi.Find ("yiqibianhao = '" + txtyqbh.Text + "'")
If Not rstxinxi.EOF Then
MsgBox "此仪器编号已经存在!", vbOKOnly + vbExclamation, "警告"
txtyqbh.Text = ""
txtyqbh.SetFocus
Else
rstxinxi.AddNew
rstxinxi.Fields("yiqibianhao") = Trim(txtyqbh.Text)
rstxinxi.Fields("fenleihao") = Trim(txtflh.Text)
rstxinxi.Fields("xinghao") = Trim(txtxh.Text)
rstxinxi.Fields("yiqimingcheng") = Trim(txtyqmc.Text)
rstxinxi.Fields("guige") = Trim(txtgg.Text)
rstxinxi.Fields("danjia") = Trim(txtdj.Text)
rstxinxi.Fields("changjia") = Trim(txtcj.Text)
rstxinxi.Fields("gouzhiriqi") = Trim(txtgzrq.Text)
rstxinxi.Fields("xianzhuang") = Trim(txtxz.Text)
rstxinxi.Fields("lingyongren") = Trim(txtlyr.Text)
rstxinxi.Fields("jingshouren") = Trim(txtjsr.Text)
rstxinxi.Fields("rukushijian") = Trim(txtrksj.Text)
rstxinxi.Update
MsgBox "添加信息成功", vbOKOnly + vbExclamation, "信息提示"
Call Command1_Click
rstxinxi.Close
xinxi.Close
End If
End If
End Sub
Private Sub Command3_Click()
Option1.Value = False
Option2.Value = False
txtyqbh.Text = ""
txtflh.Text = ""
txtyqmc.Text = ""
txtxh.Text = ""
txtgg.Text = ""
txtdj.Text = ""
txtcj.Text = ""
txtgzrq.Text = ""
txtxz.Text = ""
txtjsr.Text = ""
txtlyr.Text = ""
txtrksj.Text = ""
End Sub
Private Sub Form_Load()
Set xinxi = New ADODB.Connection
xinxi.CursorLocation = adUseClient
xinxi.Open "Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=F:\仓库管理系统\cangkuzl.mdb;Persist Security Info=False"
Set rstxinxi = New ADODB.Recordset
Set rstxinxi.ActiveConnection = xinxi
rstxinxi.Open "select * from yiqixinxi", xinxi, adOpenStatic, adLockOptimistic
End Sub
Private Sub a11_Click(Index As Integer)
Select Case Index
Case 0
Unload Me
Load Formtianjia
Formtianjia.Show
Case 2
Unload Me
Load Formxiugai
Formxiugai.Show
Case 3
Unload Me
Load Formshanchu
Formshanchu.Show
End Select
End Sub
Private Sub f11_Click(Index As Integer)
Select Case Index
Case 0
Unload Me
Load mainForm
mainForm.Show
Case 2
Dim i As Byte
Beep
i = MsgBox("你确定要退出仓库管理系统吗?", vbYesNo, "退出系统")
If i = vbYes Then
End
End If
End Select
End Sub
Private Sub s11_Click(Index As Integer)
Select Case Index
Case 0
Unload Me
Load Formchaxun
Formchaxun.Show
End Select
End Sub
Private Sub Timer1_Timer()
Labelsj.Caption = Now
End Sub
在visual basic中新建一个form,保存为formshanchu.frm。从工具箱中选择相应控件将其添加到窗体中,根据需要设置其各项属性,最后的删除信息窗体如图所示。
将窗体及其各控件的属性设置完毕后,根据需要为窗体及控件添加事件处理函数,程序如下:
Dim xinxi As New ADODB.Connection
Dim rstxinxi As New ADODB.Recordset
Private Sub Command3_Click()
Option1.Value = False
Option2.Value = False
txtyqbh.Text = ""
txtflh.Text = ""
txtyqmc.Text = ""
txtxh.Text = ""
txtgg.Text = ""
txtdj.Text = ""
txtcj.Text = ""
txtgzrq.Text = ""
txtxz.Text = ""
txtjsr.Text = ""
txtlyr.Text = ""
txtrksj.Text = ""
End Sub
Private Sub Form_Load()
Set xinxi = New ADODB.Connection
xinxi.CursorLocation = adUseClient
xinxi.Open "Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=F:\仓库管理系统\cangkuzl.mdb;Persist Security Info=False"
Set rstxinxi = New ADODB.Recordset
Set rstxinxi.ActiveConnection = xinxi
rstxinxi.Open "select * from yiqixinxi", xinxi, adOpenStatic, adLockOptimistic
End Sub
Private Sub Command1_Click()
If Option1.Value = True Then
Option2.Value = False
Text1.SetFocus
Set xinxi = New ADODB.Connection
xinxi.CursorLocation = adUseClient
xinxi.Open "Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=F:\仓库管理系统\cangkuzl.mdb;Persist Security Info=False"
Set rstxinxi = New ADODB.Recordset
Set rstxinxi.ActiveConnection = xinxi
rstxinxi.Open "select * from yiqixinxi", xinxi, adOpenStatic, adLockOptimistic
If Text1.Text = "" Then
MsgBox "请输入仪器编号", vbOKOnly, "警告"
Text1.SetFocus
Else
rstxinxi.Find ("yiqibianhao = '" + Text1.Text + "'")
If rstxinxi.EOF Then
MsgBox "此仪器编号不存在,请重新输入!", vbOKOnly, "警告"
Text1.Text = ""
Else
txtyqbh.Text = rstxinxi.Fields("yiqibianhao")
txtflh.Text = rstxinxi.Fields("fenleihao")
txtyqmc.Text = rstxinxi.Fields("yiqimingcheng")
txtxh.Text = rstxinxi.Fields("xinghao")
txtgg.Text = rstxinxi.Fields("guige")
txtdj.Text = rstxinxi.Fields("danjia")
txtcj.Text = rstxinxi.Fields("changjia")
txtgzrq.Text = rstxinxi.Fields("gouzhiriqi")
txtxz.Text = rstxinxi.Fields("xianzhuang")
txtlyr.Text = rstxinxi.Fields("lingyongren")
txtjsr.Text = rstxinxi.Fields("jingshouren")
txtrksj.Text = rstxinxi.Fields("rukushijian")
rstxinxi.Close
xinxi.Close
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页