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

📄 frm_badj.frm

📁 小区物业管理系统,(vb6+SQLServer2000+使用说明)
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame Frame3 
      Height          =   705
      Left            =   3105
      TabIndex        =   22
      Top             =   2355
      Width           =   3165
      Begin VB.CommandButton Command11 
         Caption         =   "退出"
         Height          =   400
         Left            =   2505
         TabIndex        =   29
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command10 
         Caption         =   "浏览"
         Height          =   400
         Left            =   1905
         TabIndex        =   28
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command8 
         Caption         =   "修改"
         Height          =   400
         Left            =   690
         TabIndex        =   26
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command6 
         Caption         =   "添加"
         Height          =   400
         Left            =   90
         TabIndex        =   24
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command5 
         Caption         =   "保存"
         Height          =   400
         Left            =   90
         TabIndex        =   23
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command9 
         Caption         =   "取消"
         Height          =   400
         Left            =   690
         TabIndex        =   27
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command7 
         Caption         =   "删除"
         Height          =   400
         Left            =   1305
         TabIndex        =   25
         Top             =   225
         Width           =   615
      End
      Begin VB.CommandButton Command12 
         Caption         =   "更新"
         Height          =   400
         Left            =   1305
         TabIndex        =   47
         Top             =   225
         Width           =   615
      End
   End
   Begin VB.Frame Frame2 
      Height          =   705
      Left            =   90
      TabIndex        =   17
      Top             =   2355
      Width           =   3045
      Begin VB.CommandButton Command4 
         Caption         =   ">|"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Left            =   2175
         TabIndex        =   21
         Top             =   240
         Width           =   710
      End
      Begin VB.CommandButton Command3 
         Caption         =   ">"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Left            =   1485
         TabIndex        =   20
         Top             =   240
         Width           =   710
      End
      Begin VB.CommandButton Command2 
         Caption         =   "<"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Left            =   795
         TabIndex        =   19
         Top             =   240
         Width           =   710
      End
      Begin VB.CommandButton Command1 
         Caption         =   "|<"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Left            =   105
         TabIndex        =   18
         Top             =   240
         Width           =   710
      End
   End
End
Attribute VB_Name = "frm_badj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim KeyCode As String
Private Sub Command10_Click()   '浏览
    Frm_pbinfo.Show    '调入保安信息窗体
End Sub
Private Sub Command11_Click()  '退出
    Unload Me
End Sub
Private Sub Command12_Click() '更新
    Command7.Visible = True    '删除按钮可见
    Me.Visible = False
    Dim rs2 As New ADODB.Recordset
    rs2.Open "select * from tab_pb where 编号='" + Text14.Text + "'", cn, adOpenKeyset, adLockOptimistic
    If rs2.RecordCount > 0 Then
        rs2.Fields("编号") = Text1.Text
        rs2.Fields("值勤人") = Text6.Text
        rs2.Fields("值勤目的") = Text2.Text
        rs2.Fields("值勤岗位") = Text3.Text
        rs2.Fields("巡逻路线") = Text5.Text
        rs2.Fields("当发生事") = Text8.Text
        rs2.Fields("事故处理情况") = Text4.Text
        rs2.Fields("日期") = Str(DTPicker1.Value)
        rs2.Update  '更新数据
    End If
    MsgBox "信息修改成功", , "系统提示"
    Adodc1.Refresh
    Command6.Enabled = True  '添加按钮可用
End Sub



Private Sub Command1_Click()  '"|<"按钮
    Frame1.Visible = False
    Frame4.Visible = True
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.MoveFirst
          DTPicker2.Value = Adodc1.Recordset.Fields("日期")
    Else
        MsgBox "没有记录!", , "系统提示"
    End If
'    adodc1.Recordset.MoveFirst
      

End Sub
Private Sub Command2_Click()   '"<"按钮
    Frame1.Visible = False
    Frame4.Visible = True
'    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.MovePrevious
        If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
    DTPicker2.Value = Adodc1.Recordset.Fields("日期")
  Else
        MsgBox "没有记录!", , "系统提示"
    End If
'    Adodc1.Recordset.MovePrevious
'    If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
      
End Sub

Private Sub Command3_Click()  '">"按钮
    Frame1.Visible = False
    Frame4.Visible = True
'    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.MoveNext
        If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
         DTPicker2.Value = Adodc1.Recordset.Fields("日期")
    Else
        MsgBox "没有记录!", , "系统提示"
    End If
'    Adodc1.Recordset.MoveNext
'    If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
       

End Sub
Private Sub Command4_Click()  '">|"按钮
    Frame1.Visible = False
    Frame4.Visible = True
    Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
    Adodc1.Recordset.MoveLast
     DTPicker2.Value = Adodc1.Recordset.Fields("日期")

Else
        MsgBox "没有记录!", , "系统提示"
    End If

'    Adodc1.Recordset.MoveLast
       
End Sub
Private Sub Command5_Click()  '保存
    If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text8.Text = "" Then
        MsgBox "输入信息不能为空!", , "系统提示"
    Else
        Set adors = cn.Execute("insert into tab_pb values(" & Text1 & ",'" & Text6 & "','" & Text2 & "','" & Text3 & "','" & Text5 & "','" & Text8 & "','" & Text4 & "','" & DTPicker1.Value & "') ")
        MsgBox "数据保存成功", , "系统提示"
        Command6.Visible = True   '添加按钮可用
        Command5.Visible = False  '保存按钮不可用
        Command7.Enabled = True   '删除按钮可用
        Adodc1.Refresh
    End If
End Sub
Private Sub Command6_Click() '添加
    DTPicker1.Value = Date
    Frame1.Visible = True
    Frame4.Visible = False
    '清空文本框内容
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text8.Text = ""
    Command5.Visible = True   ' 保存按钮可用
    Command9.Visible = True   ' 取消按钮可用
    Command6.Visible = False  ' 添加按钮不可用
    Command8.Visible = False  ' 修改按钮不可用
    Text6.SetFocus    '执勤人获得焦点
    Command7.Enabled = False   '删除不可用
    Adodc1.RecordSource = "select * from tab_pb"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then    '如果记录数大于零
        If Adodc1.Recordset.EOF = False Then
            Adodc1.Recordset.MoveLast
            Text1.Text = Format(Val(Right(Adodc1.Recordset.Fields("编号"), 3)) + 1, "###000")   '编号自动加1
            'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
            'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
        Else
        End If
    Else
        Text1.Text = "001"
    End If
End Sub

Private Sub Command7_Click()  '删除
    Frame4.Visible = True
    Frame1.Visible = False
    Dim myval As String
    Adodc1.RecordSource = "select * from tab_pb"
    If Adodc1.Recordset.RecordCount > 0 Then    '如果记录数大于零
        myval = MsgBox("确定删除该记录吗?", vbYesNo, "系统提示")
        'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
        If myval = vbYes Then
            Adodc1.Recordset.Delete   '删除该记录
            Adodc1.Refresh     '刷新
            Unload Me
            Adodc1.Refresh
            frm_badj.Show
        Else
        End If
    Else
        MsgBox "数据库中没有记录要删除!", , "系统提示"
    End If
End Sub
Private Sub Command8_Click()  '修改
    Command12.Visible = True   '更新按钮不可见
    Command7.Visible = False   '删除按钮不可见
    Frame1.Visible = True
    Frame4.Visible = False
    Text6.SetFocus  '执勤人获得焦点
    Command6.Enabled = False  '添加按钮不可用
    Dim rs1 As New ADODB.Recordset
    rs1.Open "select * from tab_pb where 编号='" + Text14.Text + "'", cn, adOpenKeyset, adLockOptimistic
    If rs1.RecordCount > 0 Then     '如果记录数大于零
        '在文本框中显示记录信息
        Text1.Text = rs1.Fields("编号")
        Text2.Text = rs1.Fields("值勤目的")
        Text3.Text = rs1.Fields("值勤岗位")
        Text4.Text = rs1.Fields("事故处理情况")
        Text5.Text = rs1.Fields("巡逻路线")
        Text6.Text = rs1.Fields("值勤人")
        Text8.Text = rs1.Fields("当发生事")
        DTPicker1.Value = rs1.Fields("日期")
    End If
End Sub
Private Sub Command9_Click()  '取消
    Command6.Visible = True   '添加按钮可用
    Command5.Visible = False  '保存按钮不可用
    Command7.Enabled = True   '删除按钮可用
    '清空文本信息
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
End Sub
Private Sub Form_Load()

    '自动识别路径
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
    Adodc1.RecordSource = "select * from tab_pb "
    Adodc1.Refresh
    
    
'    If Adodc1.Recordset.RecordCount > 0 Then    '如果记录数大于零
'        If Adodc1.Recordset.EOF = False Then
'            Adodc1.Recordset.MoveLast
'            DTPicker2.Value = Adodc1.Recordset.Fields("日期")
'        End If
'    End If
'If Text14 = "" And Text1 = "" Then
'   Exit Sub
'   Else
'
'    DTPicker2.Value = Adodc1.Recordset.Fields("日期")
'End If
                DTPicker2.Value = Date
        End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then    '按回车键Text6获得焦点
        Text6.SetFocus
    End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then    '按回车键Text3获得焦点
        Text3.SetFocus
    End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then    '按回车键Text4获得焦点
        Text4.SetFocus
    End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then    '按回车键 Text5获得焦点
        Text5.SetFocus
    End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then    '按回车键Text8获得焦点
        Text8.SetFocus
    End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then     '按回车键Text2获得焦点
        Text2.SetFocus
    End If
End Sub

⌨️ 快捷键说明

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