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

📄 资料录入.frm

📁 可以帮助交通部门管理车辆肇事后的相关事宜
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
   End
   Begin VB.CommandButton Command3 
      Caption         =   "添加记录"
      Height          =   495
      Left            =   5040
      TabIndex        =   0
      Top             =   2880
      Width           =   1455
   End
   Begin VB.CommandButton Command6 
      Caption         =   "保存记录"
      Enabled         =   0   'False
      Height          =   495
      Left            =   5040
      TabIndex        =   1
      Top             =   3600
      Width           =   1455
   End
   Begin VB.CommandButton Command16 
      Caption         =   "退出"
      Height          =   495
      Left            =   5040
      TabIndex        =   2
      Top             =   5760
      Width           =   1455
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   5040
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "jjdd"
      Top             =   7080
      Visible         =   0   'False
      Width           =   4500
   End
End
Attribute VB_Name = "资料录入"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click(Index As Integer)
Text2.Locked = False
 Text3.Locked = False
 Text6.Locked = False
 Text7.Locked = False
 Text8.Locked = False
 Text11.Locked = False
 Combo1.Locked = False
 Data1.Recordset.Edit
 Command6.Enabled = True
End Sub

Private Sub Command16_Click()
进入界面.Show
Unload Me
End Sub

Private Sub Command2_Click()
ianswer = MsgBox("确定要删除该项业务?", vbYesNo, "提示框")
If ianswer = vbYes Then
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub

Private Sub Command3_Click()

 Text1.Locked = False
 Text2.Locked = False
 Text3.Locked = False
 Text6.Locked = False
 Text7.Locked = False
 Text8.Locked = False
 Text11.Locked = False
 Combo1.Locked = False
 
 
 Text2.SetFocus
 
 n = Data1.Recordset.RecordCount
 If n = 0 Then
    
    If Data1.Recordset.EOF Then
       Data1.Recordset.AddNew
    Else
       Data1.Recordset.MoveLast
       Data1.Recordset.AddNew
    End If
 Else
 If Data1.Recordset.EOF Then
       Data1.Recordset.AddNew
    Else
       Data1.Recordset.MoveLast
       Data1.Recordset.AddNew
    
 End If
    
 End If
    Text7.Text = Format(Now, "yyyy-mm-dd")
    StatusBar1.Panels(1).Text = "用户资料原有记录:" & n
    StatusBar1.Panels(2).Text = "现增第" & n + 1 & "条记录"

    Command6.Enabled = True
    
    Text1.SetFocus
    Text6.Text = "插队超载"
End Sub

Private Sub Command4_Click()
If Text10.Text = "" Then
MsgBox "请输入相关数据", vbOKOnly, "提示框"
Else
    If Combo2.ListIndex = 0 Then
    Data1.Recordset.FindFirst "Num='" & Text10.Text & " '"
    If (Data1.Recordset.NoMatch) Then
        MsgBox "你要找的内容未找到!", vbCritical, "提示框"
           Text10.Text = ""
           Text10.SetFocus
    End If
    ElseIf Combo2.ListIndex = 1 Then
    Data1.Recordset.FindFirst "CarNum='" & Text10.Text & " '"
    If (Data1.Recordset.NoMatch) Then
        MsgBox "你要找的内容未找到!", vbCritical, "提示框"
           Text10.Text = ""
           Text10.SetFocus
    End If
    ElseIf Combo2.ListIndex = 2 Then
    Data1.Recordset.FindFirst "Driver='" & Text10.Text & " '"
    If (Data1.Recordset.NoMatch) Then
        MsgBox "你要找的内容未找到!", vbCritical, "提示框"
           Text10.Text = ""
           Text10.SetFocus
    End If
    Else
    Data1.Recordset.FindFirst "Action='" & Text10.Text & " '"
    If (Data1.Recordset.NoMatch) Then
        MsgBox "你要找的内容未找到!", vbCritical, "提示框"
           Text10.Text = ""
           Text10.SetFocus
    End If
    
    End If
End If
Text15.Text = Text10.Text
End Sub

Private Sub Command5_Click()
If Combo2.ListIndex = 0 Then
    Data1.Recordset.FindNext "Num='" & Text10.Text & " '"
ElseIf Combo2.ListIndex = 1 Then
    Data1.Recordset.FindNext "CarNum='" & Text10.Text & " '"
ElseIf Combo2.ListIndex = 2 Then
    Data1.Recordset.FindNext "Driver='" & Text10.Text & " '"
Else
    Data1.Recordset.FindNext "Action='" & Text10.Text & " '"
End If
If Text10.Text = Text15.Text Then
        MsgBox "这是最后一条相关记录!", vbOKOnly, "提示框"
    Else
        
        
        Command5.SetFocus
        Text15.Text = Text10.Text
    End If
End Sub

Private Sub Command6_Click()
 
  If Text2 = "" Then
        MsgBox "车牌号不能为空,请输入车牌号!", vbExclamation
        Text2.SetFocus
      ElseIf Text3 = "" Then
        MsgBox "驾驶人不能为空,请输入驾驶人姓名!", vbExclamation
        Text3.SetFocus
      ElseIf Text8 = "" Then
        MsgBox "暂扣地点不能为空,请输入暂扣地点!", vbExclamation
        Text8.SetFocus
      ElseIf Text11 = "" Then
        MsgBox "执勤民警不能为空,请输入执勤民警姓名!", vbExclamation
        Text11.SetFocus
    
    ElseIf Text1 = "" Then
     MsgBox "编号不能为空!", vbOKOnly, "提示框 "
     Else
   
   
      
       Data2.Recordset.FindFirst "Num='" & Text1.Text & " '"
      
      If (Data2.Recordset.NoMatch) Then
            Command6.Enabled = False
            Text1.Locked = True
            Text2.Locked = True
            Text3.Locked = True
            Text6.Locked = True
            Text7.Locked = True
            Text8.Locked = True
            Text11.Locked = True
            Combo1.Locked = True
            If Combo1.ListIndex = 0 Or Combo1.ListIndex = 1 Or Combo1.ListIndex = 2 Then
                Data1.Recordset.Fields("Type") = 0
            Else
                Data1.Recordset.Fields("Type") = 1
            End If
             Data1.Recordset.Update
             Data1.RecordSource = "select * from jjdd order by Num"
            Data1.Recordset.MoveLast
            
            n = Data1.Recordset.RecordCount
            StatusBar1.Panels(2).Text = "记录已保存!"
            StatusBar1.Panels(1).Text = "用户资料现有记录:" & n + 1
    Else
        MsgBox "该编号已存在!请重新输入编号", vbOKOnly, "提示框"
        Text1.Text = ""
        Text1.SetFocus
    End If
    End If
End Sub

Private Sub Form_Load()
Data1.DatabaseName = App.Path + "\" + "jjdd.mdb"
Data1.Refresh


Dim n As Long
If Data1.Recordset.EOF Then
Else
Data1.Recordset.MoveLast


n = Data1.Recordset.RecordCount
StatusBar1.Panels(1).Text = "用户资料原有记录:" & n
Dim m As Integer
Data1.Recordset.MoveFirst
End If

Combo1.AddItem ("驾驶证")
Combo1.AddItem ("行驶证")
Combo1.AddItem ("其他证件")
Combo1.AddItem ("机动车")
Combo1.AddItem ("证件和机动车")

Combo2.AddItem ("编号")
Combo2.AddItem ("车牌号")
Combo2.AddItem ("驾驶人")
Combo2.AddItem ("违法行为")

Data1.RecordSource = "select * from jjdd order by Num"
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Text1 = "" Then
MsgBox "请输入编号!"
Text1.SetFocus
Else


Text2.SetFocus

End If
End If
End Sub

Private Sub Text10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text10 = "" Then
MsgBox "请输入数据!"
Text10.SetFocus
Else
Command1.SetFocus
End If
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Text2 = "" Then
MsgBox "请输入车牌号!"
Text2.SetFocus
Else


Text3.SetFocus

End If
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Text3 = "" Then
MsgBox "请输入驾驶人姓名!"
Text3.SetFocus
Else


Text6.SetFocus

End If
End If
End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Text6 = "" Then
MsgBox "请输入违法行为!"
Text6.SetFocus
Else


Text7.SetFocus

End If
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Text7 = "" Then
MsgBox "请输入录入时间!"
Text7.SetFocus
Else


Text8.SetFocus

End If
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
 If KeyAscii = 13 Then

If Text8 = "" Then
MsgBox "请输入暂扣地点!"
Text8.SetFocus
Else


Text11.SetFocus

End If
End If
End Sub
Private Sub Text11_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Text11 = "" Then
MsgBox "请输入执勤民警姓名!"
Text11.SetFocus
Else


Combo1.SetFocus

End If
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then

If Combo1.Text = "" Then
    MsgBox "请选择暂扣类型!", vbOKOnly, "提示框"
Else
    Command6.SetFocus

End If
End If
End Sub

⌨️ 快捷键说明

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