VB仓库管理系统 第3页

 Load Formchaxun

   Formchaxun.Show

End Sub

 

Private Sub Commandxxsc_Click()

   Load Formshanchu

   Formshanchu.Show

End Sub

 

Private Sub Commandxxtj_Click()

   Load Formtianjia

   Formtianjia.Show

End Sub

 

Private Sub Commandxxxg_Click()

   Load Formxiugai

   Formxiugai.Show

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

          Load Formchaxun

          Formchaxun.Show

    End Select

End Sub

 

Private Sub a11_Click(Index As Integer)

    Select Case Index

       Case 0

          Load Formtianjia

          Formtianjia.Show

       Case 2

          Load Formxiugai

          Formxiugai.Show

       Case 3

          Load Formshanchu

          Formshanchu.Show

    End Select

End Sub

 

Private Sub Timer1_Timer()

   Labelsj.Caption = Now

End Sub

3.6.5 创建窗体菜单

     在窗体设计界面中,右键单击窗体,从右键菜单中选择【menu editor…】命令,选择【menu editor…】命令将会打开【menu editor】对话框,在菜单编辑器中编辑窗体菜单。

各菜单项的单击事件处理函数如下所示:

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

          Load Formchaxun

          Formchaxun.Show

    End Select

End Sub

Private Sub a11_Click(Index As Integer)

    Select Case Index

       Case 0

          Load Formtianjia

          Formtianjia.Show

       Case 2

          Load Formxiugai

          Formxiugai.Show

       Case 3

          Load Formshanchu

          Formshanchu.Show

    End Select

End Sub

菜单编辑如图所示

 

3.6.6 创建查询信息窗体(formchaxun.frm

visual basic中新建一个form,保存为formchaxun.frm。从工具箱中选择相应控件将其添加到窗体中,根据需要设置其各项属性,最后的查询信息窗体如图所示。

 

 

 

将窗体及其各控件的属性设置完毕后,根据需要为窗体及控件添加事件处理函数,程序如下:

Dim xinxi As New ADODB.Connection

Dim rstxinxi As New ADODB.Recordset

 

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 Command2_Click()

   Option1.Value = False

   Option2.Value = False

   Text1.Text = ""

   Text2.Text = ""

   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 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

 

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

            Text1.Text = ""

            Text1.SetFocus

         End If

       End If

   Else

     If Option2.Value = True Then

     Option1.Value = False

     Text2.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 Text2.Text = "" Then

         MsgBox "请输器名", vbOKOnly, "警告"

         Text2.SetFocus

       Else

         rstxinxi.Find ("yiqimingcheng = '" + Text2.Text + "'")

         If rstxinxi.EOF Then

            MsgBox "器名不存在,重新入!", vbOKOnly, "警告"

            Text2.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

            Text2.Text = " "

            Text2.SetFocus

         End If

       End If

     End If

   End If

End Sub

3.6.7 创建修改信息窗体(formxiugai.frm

visual basic中新建一个form,保存为formxiugai.frm。从工具箱中选择相应控件将其添加到窗体中,根据需要设置其各项属性,最后的修改信息窗体如图所示。

 

 

将窗体及其各控件的属性设置完毕后,根据需要为窗体及控件添加事件处理函数,程序如下:

Dim xinxi As New ADODB.Connection

Dim rstxinxi As New ADODB.Recordset

 

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

            Text1.Text = ""

            Text1.SetFocus

         End If

       End If

   Else

     If Option2.Value = True Then

     Option1.Value = False

     Text2.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 Text2.Text = "" Then

         MsgBox "请输器名", vbOKOnly, "警告"

         Text2.SetFocus

       Else

         rstxinxi.Find ("yiqimingcheng = '" + Text2.Text + "'")

         If rstxinxi.EOF Then

            MsgBox "器名不存在,重新入!", vbOKOnly, "警告"

            Text2.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

            Text2.Text = " "

            Text2.SetFocus

         End If

       End If

     End If

   End If

End Sub

 

Private Sub Command2_Click()

    If txtyqbh.Text = "" Then

       MsgBox "请选择条记录", vbOKOnly + vbExclamation, "信息提示"

    Else

       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

       rstxinxi.Find ("yiqibianhao = '" + txtyqbh.Text + "'")

       rstxinxi.Delete

       rstxinxi.Close

       xinxi.Close

       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 Trim(txtyqbh.Text) = "" Then

         MsgBox "请输编号", vbOKOnly + vbExclamation, "信息提示"

         txtyqbh.SetFocus

         Exit Sub

       End If

       If Trim(txtflh.Text) = "" Then

         MsgBox "请输入分类号", vbOKOnly + vbExclamation, "信息提示"

         txtflh.SetFocus

         Exit Sub

       End If

       If Trim(txtyqmc.Text) = "" Then

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有