⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form4.frm

📁 这是一个仓库管理系统做不全
💻 FRM
📖 第 1 页 / 共 2 页
字号:
rs!hh = txt.Text
rs.Update
MsgBox "修改成功", vbOKOnly, "成功"
ElseIf MSFlexGrid1.TextMatrix(b, c) = Text3.Text Then
Set rs = New Recordset
str = "select * from " & Trim(a) & " where xh='" & Trim(Text1.Text) & "' and hh='" & Trim(Text2.Text) & "' and  hm='" & Trim(Text3.Text) & "'"
lian str, cn, rs
If rs.RecordCount = 1 Then
rs!hm = txt.Text
rs.Update
MsgBox "修改成功", vbOKOnly, "成功"
End If
ElseIf MSFlexGrid1.TextMatrix(b, c) = Val(Text4.Text) Then
Set rs = New Recordset
str = "select * from " & Trim(a) & " where xh='" & Trim(Text1.Text) & "' and hh='" & Trim(Text2.Text) & "' and  sl='" & Val(Text4.Text) & "'"
lian str, cn, rs
rs!sl = txt.Text
rs!je = Val(txt.Text) * Val(Text5.Text)
rs.Update
MsgBox "修改成功", vbOKOnly, "成功"
ElseIf MSFlexGrid1.TextMatrix(b, c) = Text5.Text Then
Set rs = New Recordset
str = "select * from " & Trim(a) & " where xh='" & Trim(Text1.Text) & "' and hh='" & Trim(Text2.Text) & "' and  dj='" & Val(Text5.Text) & "'"
lian str, cn, rs
rs!dj = Val(txt.Text)
rs!je = Val(txt.Text) * Val(Text4.Text)
rs.Update
MsgBox "修改成功", vbOKOnly, "成功"
ElseIf MSFlexGrid1.TextMatrix(b, c) = Text6.Text Then
Set rs = New Recordset
str = "select * from " & Trim(a) & " where xh='" & Trim(Text1.Text) & "' and hh='" & Trim(Text2.Text) & "' and  je='" & Val(Text6.Text) & "'"
lian str, cn, rs
rs!je = txt.Text
Dim c1 As Integer
c1 = MsgBox("您确定要改动总金额数目吗?", vbOKCancel, "提示")
If c1 = 1 Then
rs.Update
MsgBox "修改成功", vbOKOnly, "成功"
Else
Exit Sub
End If
End If
Call Form_Load
End Sub
Private Sub Command6_Click()
Call sh
End Sub
Private Sub Form_Load()
If Me.Command5.Enabled = False Then
txt.Enabled = False
Else
txt.Enabled = True
End If
List1.Visible = False
Set rs = New Recordset
Dim str As String
Select Case h
       Case 1
       a = "qcb"
       Case 2
       a = "grb"
       Case 3
       a = "xsb"
       Case Else
       a = "jcb"
End Select
str = "select * from " & Trim(a) & ""
lian str, cn, rs
With MSFlexGrid1
       .Rows = rs.RecordCount + 1
       .Cols = 8
       .RowHeight(0) = 400
       Dim s As Integer
        For s = 1 To .Rows - 1
         .RowHeight(s) = 800
        Next s
       .ColWidth(0) = 800
       For s = 1 To 7
       .ColWidth(s) = 2000
       Next s
       .TextMatrix(0, 0) = "序列号"
       .TextMatrix(0, 1) = "型号"
        .Col = 1
     .Row = 0
     .CellAlignment = 4
       .TextMatrix(0, 2) = "货号"
       .TextMatrix(0, 3) = "货名"
       .TextMatrix(0, 4) = "数量"
       .TextMatrix(0, 5) = "单价"
       .TextMatrix(0, 6) = "金额"
       .TextMatrix(0, 7) = "日期"
        .Col = 2
     .Row = 0
     .CellAlignment = 4
        code = 1
        Do While code < .Rows
        .TextMatrix(code, 0) = code
        code = code + 1
        Loop
        For code = 1 To rs.RecordCount
        .TextMatrix(code, 1) = rs!xh
        .TextMatrix(code, 2) = rs!hh
        .TextMatrix(code, 3) = rs!hm
        .TextMatrix(code, 4) = rs!sl
        .TextMatrix(code, 5) = rs!dj
        .TextMatrix(code, 6) = rs!je
        .TextMatrix(code, 7) = rs!rq
        rs.MoveNext
        Next code
        End With
End Sub



Private Sub List1_Click()
If List1.Top = Text1.Top + Text1.Height Then
 Text1.Text = List1.Text
 ElseIf List1.Top = Text2.Top + Text2.Height Then
 Text2.Text = List1.Text
 Else
 Text3.Text = List1.Text
 End If
 End Sub
Private Sub MSFlexGrid1_Click()
b = MSFlexGrid1.Row
c = MSFlexGrid1.Col
Text1.Text = MSFlexGrid1.TextMatrix(b, 1)
Text2.Text = MSFlexGrid1.TextMatrix(b, 2)
Text3.Text = MSFlexGrid1.TextMatrix(b, 3)
Text4.Text = MSFlexGrid1.TextMatrix(b, 4)
Text5.Text = MSFlexGrid1.TextMatrix(b, 5)
Text6.Text = MSFlexGrid1.TextMatrix(b, 6)
If MSFlexGrid1.TextMatrix(b, 7) = "日期" Then
Else
DTPicker1.Value = MSFlexGrid1.TextMatrix(b, 7)
End If
End Sub
Private Sub MSFlexGrid1_DblClick()
Call YiDongTXT(MSFlexGrid1, txt, MSFlexGrid1.Rows, MSFlexGrid1.Cols)
End Sub
Private Sub Text1_Change()
List1.Clear
List1.Top = Text1.Top + Text1.Height
List1.Left = Text1.Left
If Text1.Text = "" Then
List1.Visible = False
Else
List1.Visible = True
Set rs = New Recordset
Dim str As String
str = "select * from " & Trim(a) & " where xh like  '%" & Trim(Text1.Text) & "%'"
Call lian(str, cn, rs)
If rs.RecordCount < 1 Then
List1.Visible = False
Else
Dim i As Integer
For i = 1 To rs.RecordCount
If Trim(rs!xh) = Trim(Text1.Text) Then List1.Visible = False
List1.AddItem (rs!xh)
rs.MoveNext
Next i
cn.Close
End If
End If
If Text1.Text = List1.Text Then List1.Visible = False
End Sub
Private Sub Text2_Change()
List1.Clear
List1.Top = Text2.Top + Text2.Height
List1.Left = Text2.Left
If Text2.Text = "" Then
List1.Visible = False
Else
List1.Visible = True
Set rs = New Recordset
Dim str As String
str = "select * from " & Trim(a) & " where hh like  '%" & Trim(Text2.Text) & "%'"
Call lian(str, cn, rs)
If rs.RecordCount < 1 Then
List1.Visible = False
Else
Dim i As Integer
For i = 1 To rs.RecordCount
If Trim(rs!hh) = Trim(Text2.Text) Then List1.Visible = False
List1.AddItem (rs!hh)
rs.MoveNext
Next i
cn.Close
End If
End If
If Text2.Text = List1.Text Then List1.Visible = False
End Sub
Private Sub Text3_Change()
List1.Clear
List1.Top = Text3.Top + Text3.Height
List1.Left = Text3.Left
If Text3.Text = "" Then
List1.Visible = False
Else
List1.Visible = True
Set rs = New Recordset
Dim str As String
str = "select * from " & Trim(a) & " where hm like  '%" & Trim(Text3.Text) & "%'"
Call lian(str, cn, rs)
If rs.RecordCount < 1 Then
List1.Visible = False
Else
Dim i As Integer
For i = 1 To rs.RecordCount
If Trim(rs!hm) = Trim(Text3.Text) Then List1.Visible = False
List1.AddItem (rs!hm)
rs.MoveNext
Next i
cn.Close
End If
End If
If Text3.Text = List1.Text Then List1.Visible = False
str = "select * from " & Trim(a) & " where xh='" & Trim(Text1.Text) & "' and hh='" & Trim(Text2.Text) & "' and hm='" & Trim(Text3.Text) & "'"
lian str, cn, rs
If rs.RecordCount = 1 Then
Text4.Text = rs!sl
Text5.Text = rs!dj
DTPicker1.Value = rs!rq
End If
End Sub
Private Sub Txt_keypress(keyascii As Integer) '\'添加完数据后,进行当前位置的判断
  If keyascii = vbKeyReturn Then
  Call JianYanTXT(MSFlexGrid1, txt)
  Call WanBiTXT(MSFlexGrid1, txt, 15, 3)
  End If
  If keyascii = vbKeyEscape Then
    mshlexgrid1.SetFocus
    End If
End Sub
Private Function YiDongTXT(Table As MSFlexGrid, kongJian As TextBox, RowNum As Integer, ColNum As Integer)
  If Table.Col <= ColNum And Table.Row <= RowNum Then
     kongJian.Left = Table.Left + Table.ColPos(Table.Col)
     kongJian.Top = Table.Top + Table.RowPos(Table.Row)
     kongJian.Width = Table.ColWidth(Table.Col)
     kongJian.Height = Table.RowHeight(Table.Row)
     kongJian.Text = Table.Text
     End If
End Function
Private Function JianYanTXT(Table As MSFlexGrid, kongJian As TextBox)
   Table.Text = kongJian.Text
End Function
Private Function WanBiTXT(Table As MSFlexGrid, kongJian As TextBox, RowNum As Integer, ColNum As Integer)
   If Table.Col = ColNum Then
        Table.Col = 0
       If Table.Row = RowNum Then
             Table.Row = 1
             Table.Col = 0
          Else
            Table.Row = Table.Row + 1
       End If
   End If
     kongJian.Left = Table.Left + Table.ColPos(Table.Col)
     kongJian.Top = Table.Top + Table.RowPos(Table.Row)
     kongJian.Width = Table.ColWidth(Table.Col)
     kongJian.Height = Table.RowHeight(Table.Row)
     kongJian.Text = Table.Text
     kongJian.Visible = True
     kongJian.SetFocus
 End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -