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

📄 main_ht_htlr.frm

📁 销售合同的咚咚
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Index           =   3
         Left            =   2505
         Picture         =   "main_ht_htlr.frx":0000
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   240
         Width           =   800
      End
      Begin VB.CommandButton CmdMD 
         BackColor       =   &H00FFC0C0&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Index           =   2
         Left            =   1710
         Picture         =   "main_ht_htlr.frx":15AD
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   240
         Width           =   800
      End
      Begin VB.CommandButton CmdMD 
         BackColor       =   &H00FFC0C0&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Index           =   1
         Left            =   915
         Picture         =   "main_ht_htlr.frx":2AB1
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   240
         Width           =   800
      End
      Begin VB.CommandButton CmdMD 
         BackColor       =   &H00FFC0C0&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Index           =   0
         Left            =   120
         Picture         =   "main_ht_htlr.frx":3FE3
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   240
         Width           =   800
      End
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "E:\VB程序设计\xhgl.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   360
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "合同表"
      Top             =   0
      Visible         =   0   'False
      Width           =   1815
   End
   Begin VB.Label Label9 
      Caption         =   "合同录入模式"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   495
      Left            =   2640
      TabIndex        =   0
      Top             =   0
      Width           =   3135
   End
End
Attribute VB_Name = "main_ht_htlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i
Public Sub viewdata()      '定义显示数据的函数
 For i = 0 To 7
  If Data1.Recordset.Fields(i) <> "" Then Text1(i).Text = Data1.Recordset.Fields(i) Else Text1(i).Text = ""
 Next i
End Sub
Private Sub CmdMD_Click(Index As Integer)
 Select Case Index
 Case Is = 0     '移到第一条记录
  If Not Data1.Recordset.BOF Then Data1.Recordset.MoveFirst
 Case Is = 1     '移到上一条记录
  If Data1.Recordset.RecordCount <> 0 Then
   If Data1.Recordset.BOF = False Then Data1.Recordset.MovePrevious
   If Data1.Recordset.BOF = True Then Data1.Recordset.MoveFirst
  End If
 Case Is = 2     '移到下一条记录
  If Data1.Recordset.RecordCount <> 0 Then
   If Data1.Recordset.EOF = False Then Data1.Recordset.MoveNext
   If Data1.Recordset.EOF = True Then Data1.Recordset.MoveLast
  End If
 Case Is = 3     '移到最后一条记录
  If Data1.Recordset.RecordCount <> 0 Then
   If Not Data1.Recordset.EOF Then Data1.Recordset.MoveLast
  End If
 End Select
 Call viewdata     '调用函数
End Sub

Private Sub ComAdd_Click()
 For i = 0 To 7
      Text1(i).Text = ""
      Text1(i).Enabled = True
  Next i
  ComSaveM.Visible = True: ComSaveA.Visible = False: ComSaveM.Enabled = True: ComEsc.Enabled = True
  For i = 0 To 3
   CmdMD(i).Enabled = False
  Next i
  ComAdd.Enabled = False: ComModify.Enabled = False: ComDelete.Enabled = False
   Text1(0).SetFocus
End Sub

Private Sub ComDelete_Click()
If Data1.Recordset.RecordCount > 0 Then
    A = MsgBox("您确实要删除这条数据吗?", vbYesNo)
    If A = vbYes Then
     Data1.Recordset.Delete
     Data1.Refresh
     For i = 0 To 3
      CmdMD(i).Enabled = True
     Next i
     ComModify.Enabled = True: ComDelete.Enabled = True
     ComSaveA.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
     For i = 0 To 7
         Text1(i).Text = ""
     Next i
    End If
  Else
    MsgBox ("没有要删除的数据!")
 End If
End Sub

Private Sub Comend_Click()
  frm_main.Enabled = True
  Unload Me
  Unload main_ht_bg
End Sub

Private Sub ComEsc_Click()
If Data1.Recordset.RecordCount > 0 Then
  For i = 0 To 7
      Text1(i).Enabled = False
      If Data1.Recordset.Fields(i) <> "" Then Text1(i).Text = Data1.Recordset.Fields(i)
  Next i
  For i = 0 To 3
   CmdMD(i).Enabled = True
  Next i
  ComModify.Enabled = True: ComDelete.Enabled = True: ComSaveA.Enabled = False
  ComSaveM.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
 End If
End Sub

Private Sub ComModify_Click()
If Data1.Recordset.RecordCount > 0 Then
  Data1.Recordset.Edit
  For i = 0 To 7
  Text1(i).Enabled = True
  Next i
  ComSaveA.Visible = True: ComSaveA.Enabled = True: ComSaveM.Visible = False: ComEsc.Enabled = True
  For i = 0 To 3
   CmdMD(i).Enabled = False
  Next i
  ComAdd.Enabled = False: ComModify.Enabled = False: ComDelete.Enabled = False
 Else
  MsgBox ("没有要修改的数据!")
 End If
End Sub

Private Sub ComSaveA_Click()
 Dim A As String
  A = MsgBox("您确实要修改这条数据吗?", vbYesNo)
  If A = vbYes Then
     Data1.Recordset.Edit
     For i = 0 To 7
         If Text1(i).Text <> "" Then Data1.Recordset.Fields(i) = Text1(i).Text
         Text1(i).Enabled = False
     Next i
     ComSaveA.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
     For i = 0 To 3
      CmdMD(i).Enabled = True
     Next i
     ComModify.Enabled = True: ComDelete.Enabled = True: Data1.Recordset.Update
  End If
End Sub

Private Sub ComSaveM_Click()
  
Dim myrs1 As Recordset
  If Text1(0).Text <> "" And Text1(1).Text <> "" Then
     Set mydb1 = Workspaces(0).OpenDatabase(App.Path & "\xhgl.mdb")
     Set myrs1 = mydb1.OpenRecordset("合同表", dbOpenTable)
     myrs1.AddNew
     For i = 0 To 7
         If Text1(i).Text <> "" Then myrs1.Fields(i) = Text1(i).Text
     Next i
     myrs1.Update: myrs1.Close: mydb1.Close: Data1.Refresh
     For i = 0 To 3
      CmdMD(i).Enabled = True
     Next i
     ComModify.Enabled = True: ComDelete.Enabled = True
     ComSaveA.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
    Else
  End If
 
End Sub

Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
'回车获得焦点
 If KeyCode = vbKeyReturn And Index < 16 Then Text1(Index + 1).SetFocus
End Sub

⌨️ 快捷键说明

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