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

📄 changemodel.frm

📁 计算机CAD图纸管理和预览
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form changemodel 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "机型修改"
   ClientHeight    =   5430
   ClientLeft      =   3585
   ClientTop       =   3150
   ClientWidth     =   8310
   Icon            =   "changemodel.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5430
   ScaleWidth      =   8310
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdNext 
      Caption         =   "下一个"
      Height          =   375
      Left            =   2040
      TabIndex        =   17
      Top             =   4920
      Width           =   1215
   End
   Begin VB.CommandButton cmdPrevious 
      Caption         =   "上一个"
      Height          =   375
      Left            =   600
      TabIndex        =   16
      Top             =   4920
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   1980
      Index           =   5
      Left            =   360
      TabIndex        =   15
      Top             =   2520
      Width           =   7575
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   300
      Index           =   4
      Left            =   5280
      TabIndex        =   14
      Top             =   1005
      Width           =   2655
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   300
      Index           =   3
      Left            =   5280
      TabIndex        =   13
      Top             =   430
      Width           =   2655
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   300
      Index           =   2
      Left            =   1320
      TabIndex        =   12
      Top             =   1600
      Width           =   2655
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   300
      Index           =   1
      Left            =   1320
      TabIndex        =   11
      Top             =   1005
      Width           =   2655
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0FFFF&
      Height          =   300
      Index           =   0
      Left            =   1320
      TabIndex        =   2
      Top             =   430
      Width           =   2655
   End
   Begin VB.CommandButton CancelButton 
      Cancel          =   -1  'True
      Caption         =   "退出"
      Height          =   375
      Left            =   6480
      TabIndex        =   1
      Top             =   4920
      Width           =   1215
   End
   Begin VB.CommandButton SAVEButton 
      Caption         =   "修改"
      Default         =   -1  'True
      Height          =   375
      Left            =   5040
      TabIndex        =   0
      Top             =   4920
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Height          =   4575
      Left            =   120
      TabIndex        =   3
      Top             =   120
      Width           =   8055
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   300
         Left            =   5160
         TabIndex        =   18
         Top             =   1490
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   529
         _Version        =   393216
         Format          =   21168129
         CurrentDate     =   38973
      End
      Begin VB.Label Label7 
         Caption         =   "备注"
         Height          =   375
         Left            =   240
         TabIndex        =   10
         Top             =   2160
         Width           =   975
      End
      Begin VB.Label Label6 
         Caption         =   "开发年月"
         Height          =   375
         Left            =   4200
         TabIndex        =   9
         Top             =   1560
         Width           =   1575
      End
      Begin VB.Label Label5 
         Caption         =   "项目组员"
         Height          =   375
         Left            =   4200
         TabIndex        =   8
         Top             =   960
         Width           =   1455
      End
      Begin VB.Label Label4 
         Caption         =   "申请人"
         Height          =   375
         Left            =   4200
         TabIndex        =   7
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label3 
         Caption         =   "申请图号"
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   1560
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "机型名称"
         Height          =   255
         Left            =   240
         TabIndex        =   5
         Top             =   960
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "机型代号"
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "changemodel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Public upok As Boolean
Private Sub cmdNext_Click()
    If modelrs.RecordCount > 0 And modelrs.EOF = False Then
        modelrs.MoveNext
    If Not modelrs.EOF Then
        Call textshow(modelrs)
    End If
    Else
      modelrs.MovePrevious '指向最后一个
      MsgBox "已经到最后记录!", vbInformation + vbOKOnly, "移动记录"
    End If
End Sub

Private Sub cmdPrevious_Click()
If modelrs.RecordCount > 0 And modelrs.BOF = False Then

    modelrs.MovePrevious
    If Not modelrs.BOF Then
        Call textshow(modelrs)
    
    End If
Else
    modelrs.MoveNext     ' 指向第一个
    MsgBox "已经到最前记录!", vbInformation + vbOKOnly, "移动记录"
End If
End Sub
Private Sub textshow(ByVal rctSource As ADODB.Recordset)
Dim vtempdata  As Variant

With rctSource
    vtempdata = .Fields("机型代号")
    If Trim(vtempdata) <> Empty Then
        Text1(0).Text = Trim(vtempdata)
    Else
        Text1(0).Text = Empty
    End If
    
    vtempdata = .Fields("机型名称")
    If Trim(vtempdata) <> Empty Then
        Text1(1).Text = Trim(vtempdata)
    Else
        Text1(1).Text = Empty

    End If
    
    vtempdata = .Fields("申请图号")
    If Trim(vtempdata) <> Empty Then
        Text1(2).Text = Trim(vtempdata)
    End If
    
    vtempdata = .Fields("申请人")
    If Trim(vtempdata) <> Empty Then
        Text1(3).Text = Trim(vtempdata)
    Else
        Text1(3).Text = Empty
    End If
    
    vtempdata = .Fields("项目组员")
    If Trim(vtempdata) <> Empty Then
        Text1(4).Text = Trim(vtempdata)
    Else
        Text1(4).Text = Empty
    End If
    
    vtempdata = .Fields("开发年月")
    If Trim(vtempdata) <> Empty Then
       DTPicker1.Value = vtempdata
    Else
       DTPicker1.Value = Date
    End If
    
    vtempdata = .Fields("备注")
    If Trim(vtempdata) <> Empty Then
        Text1(5).Text = Trim(vtempdata)
    Else
        Text1(5).Text = Empty
    End If
    

    
End With
End Sub


Private Sub CancelButton_Click()
    Unload Me
    upok = False
End Sub


Private Sub SAVEButton_Click()
  With modelrs
     On Error GoTo Error_On_Save
        If Trim(Text1(0).Text) <> Empty Then
            If Trim(Text1(1).Text) <> Empty Then
                If Trim(Text1(2).Text) <> Empty Then
                   If Trim(Text1(3).Text) <> Empty Then
                    .Fields("机型代号").Value = Trim(Text1(0).Text)
                    .Fields("机型名称").Value = Trim(Text1(1).Text)
                    .Fields("申请图号").Value = Trim(Text1(2).Text)
                    .Fields("申请人").Value = Trim(Text1(3).Text)
                    .Fields("项目组员").Value = Trim(Text1(4).Text)
                    .Fields("开发年月").Value = DTPicker1.Value
                    .Fields("备注").Value = Trim(Text1(5).Text)
                    .Update
                    MsgBox "保存记录成功", vbInformation, changemodel.Caption
                   Else
                      MsgBox "申请人不能为空", vbInformation, changemodel.Caption
                   End If
                Else
                    MsgBox "申请图号不能为空", vbInformation, changemodel.Caption
                End If
            Else
               MsgBox "机型名称不能为空", vbInformation, changemodel.Caption
            End If
         Else
            MsgBox "机型代号不能为空", vbInformation, changemodel.Caption
        End If
        Exit Sub
Error_On_Save:
        If Err.Number = 0 Then
            Exit Sub
        Else
            .CancelUpdate
            
            MsgBox "错误代码:" & Err.Number & vbCrLf & _
                    "错误描述:" & Err.Description, vbCritical + vbOKOnly, "保存记录失败"
                    
        End If
        
    End With

End Sub
Private Sub Form_Load()
    MakeCenter changemodel
    Call textshow(modelrs)
End Sub


Private Sub Form_Unload(Cancel As Integer)
    主菜单.modelGrid.Redraw = False
    Call 主菜单.modelShowGrid(modelrs, 主菜单.modelGrid)
    主菜单.modelGrid.Redraw = True

End Sub

⌨️ 快捷键说明

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