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

📄 frm_xqinfo.frm

📁 小区物业管理系统,(vb6+SQLServer2000+使用说明)
💻 FRM
📖 第 1 页 / 共 3 页
字号:

Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then DTPicker2.SetFocus
End Sub
Private Sub DTPicker2_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then CmdSave.SetFocus
End Sub
Private Sub CmdAdd_Click()  '添加
        On Error Resume Next

    '设置控件状态
    CmdSave.Enabled = True
    CmdCancel.Enabled = True
    CmdAdd.Enabled = False
    CmdDelete.Enabled = False
    CmdExit.Enabled = False

    For i = 0 To 3
        CmdMD(i).Enabled = False
    Next i
    '清空文本框的内容
    For i = 1 To 11
        Text1(i).Text = ""
    Next i
    Image1.Picture = LoadPicture("")
    Lbllj.Caption = ""
    adors.Open "select * from tab_xqinfo order by val(小区编号)", cn, adOpenKeyset, adLockOptimistic
    'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
    With adors
        If .RecordCount > 0 Then
            If .EOF = False Then .MoveLast
            Text1(0).Text = Val(.Fields("小区编号")) + 1
        Else
            Text1(0).Text = "1"
        End If
    End With
    adors.Close
    Text1(1).SetFocus
            For i = 0 To 3
            CmdMD(i).Enabled = False
        Next i

End Sub
Private Sub CmdAddPicture_Click()
    '添加图片
    With CommonDialog1
        .DialogTitle = "选择要追加的图片"

        .Filter = "JPG图片|*.JPG"
        .ShowOpen     '打开对话框
        Image1.Picture = LoadPicture(.FileName)
        Lbllj.Caption = .FileName
    End With
End Sub
Private Sub CmdCancel_Click()    '取消
    '清空文本框的内容
    For i = 1 To 11
        Text1(i).Text = ""
    Next i
    Image1.Picture = LoadPicture("")
    Lbllj.Caption = ""
    '设置控件状态
    CmdAdd.Enabled = True
    CmdDelete.Enabled = True
    CmdSave.Enabled = False
    CmdCancel.Enabled = False
    CmdUpdate.Enabled = True
    CmdExit.Enabled = True

    For i = 0 To 3
        CmdMD(i).Enabled = True
    Next i
End Sub

Private Sub CmdClearPicture_Click()
    Image1.Picture = LoadPicture("")
'    Lbllj.Caption = ""
''    Adodc1.RecordSource = "update tab_xqinfo set 图片='" & Lbllj & "'"
'
'       Set adors = cn.Execute("update  tab_xqinfo set 图片='" & Lbllj & "'")

  
End Sub

Private Sub CmdDelete_Click()
    CmdExit.Enabled = False

    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
    Adodc6.Refresh
    If Adodc6.Recordset.RecordCount > 0 Then
        a = MsgBox("是否删除小区信息!", vbYesNo, "系统提示")
        If a = vbYes Then
            If Adodc6.RecordSource = "select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'" Then

                Adodc2.RecordSource = "select * from tab_rkinfo where 小区名称='" & Text1(1).Text & "'"
                Adodc2.Refresh
                If Adodc2.RecordSource = "select * from tab_rkinfo where 小区名称='" & Text1(1).Text & "'" And Adodc2.Recordset.RecordCount > 0 Then
                    Sleep 1000
                    Adodc2.Recordset.Delete
                    Adodc2.Recordset.Update
                    Adodc2.RecordSource = "select * from tab_rkinfo where 小区名称='" & Text1(1).Text & "'"
                    Adodc2.Refresh
                    For i = 1 To 11
                        Text1(i).Text = ""
                    Next i
                    Image1.Picture = LoadPicture("")
                    Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

                Else

                    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
                    '                Adodc1.Refresh
                    Sleep 1000
                    Adodc6.Recordset.Delete
                    Adodc6.Recordset.Update
                    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
                    Adodc6.Refresh
                    Frm_xqinfodj.Adodc1.RecordSource = "select * from tab_xqinfo order by 小区编号"
                    Frm_xqinfodj.Adodc1.Refresh
                    For i = 1 To 11
                        Text1(i).Text = ""
                    Next i
                    Image1.Picture = LoadPicture("")
                    Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

                End If

                Adodc3.RecordSource = "select * from tab_fwinfo where 小区名称='" & Text1(1).Text & "'"
                Adodc3.Refresh
                If Adodc3.RecordSource = "select * from tab_fwinfo where 小区名称='" & Text1(1).Text & "'" And Adodc3.Recordset.RecordCount > 0 Then
                    Sleep 1000
                    Adodc3.Recordset.Delete
                    Adodc3.Recordset.Update
                    Adodc3.RecordSource = "select * from tab_fwinfo where 小区名称='" & Text1(1).Text & "'"
                    Adodc3.Refresh
                    For i = 1 To 11
                        Text1(i).Text = ""
                    Next i
                    Image1.Picture = LoadPicture("")
                    Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

                Else
                    Sleep 1000
                    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
                    '                Adodc1.Refresh
                    Adodc6.Recordset.Delete
                    Adodc6.Recordset.Update
                    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
                    Adodc6.Refresh
                    Frm_xqinfodj.Adodc1.RecordSource = "select * from tab_xqinfo order by 小区编号"
                    Frm_xqinfodj.Adodc1.Refresh
                    For i = 1 To 11
                        Text1(i).Text = ""
                    Next i
                    Image1.Picture = LoadPicture("")
                    Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

                End If

                Adodc4.RecordSource = "select * from tab_yzinfo where 小区名称='" & Text1(1).Text & "'"
                Adodc4.Refresh
                If Adodc4.RecordSource = "select * from tab_yzinfo where  小区名称='" & Text1(1).Text & "'" And Adodc4.Recordset.RecordCount > 0 Then
                    Sleep 1000
                    Adodc4.Recordset.Delete
                    Adodc4.Recordset.Update
                    Adodc4.RecordSource = "select * from tab_yzinfo where  小区名称='" & Text1(1).Text & "'"
                    Adodc4.Refresh
                    For i = 1 To 11
                        Text1(i).Text = ""
                    Next i
                    Image1.Picture = LoadPicture("")
                    Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

                Else
                    Sleep 1000
                    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
                    Adodc6.Refresh
                    Adodc6.Recordset.Delete
                    Adodc6.Recordset.Update
                    Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
                    Adodc6.Refresh
                    Frm_xqinfodj.Adodc1.RecordSource = "select * from tab_xqinfo order by 小区编号"
                    Frm_xqinfodj.Adodc1.Refresh
                    For i = 1 To 11
                        Text1(i).Text = ""
                    Next i
                    Image1.Picture = LoadPicture("")
                    Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

                End If
            End If
            Sleep 1000
            Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
            Adodc6.Refresh
            Adodc6.Recordset.Delete
            Adodc6.Recordset.Update
            Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
            Adodc6.Refresh
            Frm_xqinfodj.Adodc1.RecordSource = "select * from tab_xqinfo order by 小区编号"
            Frm_xqinfodj.Adodc1.Refresh
            For i = 1 To 11
                Text1(i).Text = ""
            Next i
            Image1.Picture = LoadPicture("")
            Lbllj.Caption = ""
            Unload Me
            Frm_xqinfo.Show

        End If
        Adodc6.RecordSource = " select * from tab_xqinfo where 小区名称 ='" + Text1(1).Text + "'"
        Adodc6.Refresh

        CmdAdd.Enabled = True
        CmdDelete.Enabled = True
        CmdSave.Enabled = False
        CmdCancel.Enabled = False
        CmdUpdate.Enabled = True
        CmdExit.Enabled = True

        For i = 0 To 3
            CmdMD(i).Enabled = True
        Next i

        Exit Sub

    End If
    Unload Me
    Frm_xqinfo.Show
    
    For i = 1 To 11
        Text1(i).Text = ""
    Next i
    Image1.Picture = LoadPicture("")
    Lbllj.Caption = ""

    Me.Refresh
End Sub
Private Sub CmdMD_Click(Index As Integer)
'Adodc1.Refresh
    On Error Resume Next
    Select Case Index
    Case Is = 0     '移到第一条记录
        If Not Adodc1.Recordset.BOF Then
        Adodc1.Recordset.MoveFirst
        DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")
End If
    Case Is = 1     '移到上一条记录
        If Adodc1.Recordset.RecordCount > 0 Then
            If Adodc1.Recordset.BOF = False Then
            Adodc1.Recordset.MovePrevious
            DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")
End If
            If Adodc1.Recordset.BOF = True Then
                Adodc1.Recordset.MoveFirst
                DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")

                MsgBox "该记录为第一条记录!", , "系统提示"
            End If
        End If
    Case Is = 2     '移到下一条记录
        If Adodc1.Recordset.RecordCount > 0 Then
            If Adodc1.Recordset.EOF = False Then
            Adodc1.Recordset.MoveNext
            DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")
End If
            If Adodc1.Recordset.EOF = True Then
                Adodc1.Recordset.MoveLast
                DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")

                MsgBox "该记录为最后一条记录!", , "系统提示"
            End If
        End If
    Case Is = 3     '移到最后一条记录
        If Adodc1.Recordset.EOF = False Then
        Adodc1.Recordset.MoveLast
        DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")
End If
    End Select
    Call view_data     '调用过程
End Sub

Private Sub CmdSave_Click()
    If Text1(1).Text = "" Or Text1(2).Text = "" Or Text1(3).Text = "" Or Text1(4).Text = "" Or Text1(5).Text = "" Or Text1(6).Text = "" Or Text1(7).Text = "" Or Text1(8).Text = "" Or Text1(9).Text = "" Or Text1(10).Text = "" Or Text1(11).Text = "" Or Lbllj.Caption = "" Then
        MsgBox "输入信息不准许为空!", , "系统提示"
        Text1(1).SetFocus    '焦点设置在小区名称处
'    Else
'    If Lbllj.Caption = "" Then
'    MsgBox "请追加图片信息!", , "系统提示"
'    End If
        
    Else
        adors.Open "select * from tab_xqinfo where 小区编号='" & Text1(0) & "'", cn, adOpenKeyset, adLockOptimistic
        If adors.RecordCount > 0 Then
             On Error Resume Next
            Set adors = cn.Execute("update tab_xqinfo set 小区名称 ='" & Text1(1) & "',小区说明 ='" & Text1(2) & "',负责人 ='" & Text1(3) & "',楼栋数 ='" & Val(Text1(4)) & "',总户数 ='" & Val(Text1(5)) & "',建筑面积 ='" & Val(Text1(6)) & "',居住面积 ='" & Val(Text1(7)) & "',绿化面积 ='" & Val(Text1(8)) & "',占地面积 ='" & Val(Text1(9)) & "',地址 ='" & Text1(10) & "',备注 ='" & Text1(11) & "',图片 ='" & Lbllj.Caption & "',交工日期='" & DTPicker1 & "',竣工日期='" & DTPicker2 & "'where 小区编号='" & Val(Text1(0)) & "'")
            MsgBox "数据保存成功!", , "系统提示"
            Adodc1.Refresh
            CmdCancel_Click
            Unload Me
            Frm_xqinfo.Show
        Else
            Set adors = cn.Execute("insert into tab_xqinfo(小区名称,小区说明 ,负责人 ,楼栋数 ,总户数 ,建筑面积 ,居住面积 ,占地面积,地址,备注,图片 ,交工日期,竣工日期,小区编号) values( '" & Text1(1) & "','" & Text1(2) & "''" & Text1(3) & "','" & Text1(4) & "','" & Text1(5) & "','" & Text1(6) & "','" & Text1(7) & "','" & Text1(8) & "','" & Text1(9) & "','" & Text1(10) & "','" & Text1(11) & "','" & Lbllj.Caption & "','" & DTPicker1 & "','" & DTPicker2 & "','" & Text1(0) & "')")
            Adodc6.RecordSource = "select * from tab_xqinfo order by val(小区编号)"
            Adodc6.Refresh
            MsgBox "数据保存成功!", , "系统提示"
            Sleep 1000
            Frm_xqinfodj.Adodc1.RecordSource = "select * from tab_xqinfo order by val(小区编号)"
            Frm_xqinfodj.Adodc1.Refresh
            Unload Me
            Frm_xqinfo.Show
        End If
        '设置控件状态
        CmdAdd.Enabled = True
        CmdDelete.Enabled = True
        CmdSave.Enabled = False
        CmdCancel.Enabled = False
        CmdUpdate.Enabled = True
            CmdExit.Enabled = True

        For i = 0 To 3
            CmdMD(i).Enabled = True
        Next i
            Unload Me
            Frm_xqinfo.Show

    End If
'                Unload Me
'            Frm_xqinfo.Show

Me.Refresh
End Sub
Private Sub CmdExit_Click()   '返回
    Unload Me
    
End Sub
Private Sub Form_Load()
    DTPicker1.Value = Date
    DTPicker2.Value = Date
    '自动识别路径
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
    Adodc1.RecordSource = "select * from tab_xqinfo order by 小区编号"
    Adodc1.Refresh
    Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
    Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
    Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
    Adodc6.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc6.RecordSource = "select * from tab_xqinfo order by 小区编号"
Adodc6.Refresh
    '设置控件状态
        CmdAdd.Enabled = True
        CmdDelete.Enabled = True
        CmdSave.Enabled = False
        CmdCancel.Enabled = False
        CmdUpdate.Enabled = True
        CmdExit.Enabled = True

        For i = 0 To 3
            CmdMD(i).Enabled = True
        Next i

    CmdSave.Enabled = False
    CmdCancel.Enabled = False
    DTPicker1.Value = Date
    DTPicker2.Value = Date
End Sub

Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    If Index < 11 And KeyCode = vbKeyReturn Then
        SendKeys "{Home}+{End}"
        Text1(Index + 1).SetFocus
    End If
    If Index = 11 And KeyCode = vbKeyReturn Then DTPicker1.SetFocus
End Sub

⌨️ 快捷键说明

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