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

📄 activexexpense.frm

📁 《VB6数据库开发指南》所有的例程的源码
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmExpClient 
   Caption         =   "Expense Client"
   ClientHeight    =   3240
   ClientLeft      =   165
   ClientTop       =   795
   ClientWidth     =   7905
   LinkTopic       =   "Form1"
   ScaleHeight     =   3240
   ScaleWidth      =   7905
   StartUpPosition =   3  'Windows Default
   Begin MSFlexGridLib.MSFlexGrid dbgExpEmployee 
      Bindings        =   "ActiveXExpense.frx":0000
      Height          =   3135
      Left            =   120
      TabIndex        =   19
      Top             =   0
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   5530
      _Version        =   393216
   End
   Begin VB.CommandButton cmdSetEmployee 
      Caption         =   "&Set Employee"
      Height          =   495
      Left            =   6240
      TabIndex        =   18
      Top             =   0
      Width           =   1575
   End
   Begin VB.Data datExpEmployees 
      Caption         =   "Exp Employees"
      Connect         =   "Access"
      DatabaseName    =   "C:\My Documents\Visual Basic 6 Database How-To\New\Chapter14\HowTo06\Expense.mdb"
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   495
      Left            =   720
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   2  'Snapshot
      RecordSource    =   "ExpEmployeeNames"
      Top             =   840
      Visible         =   0   'False
      Width           =   2415
   End
   Begin MSMask.MaskEdBox mskAmountSpent 
      Height          =   285
      Left            =   3720
      TabIndex        =   3
      Top             =   1080
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   503
      _Version        =   393216
      Format          =   "$#,##0.00;($#,##0.00)"
      PromptChar      =   "_"
   End
   Begin VB.CommandButton cmdLast 
      Caption         =   "&Last"
      Height          =   495
      Left            =   5640
      TabIndex        =   10
      Top             =   2640
      Width           =   855
   End
   Begin VB.CommandButton cmdNext 
      Caption         =   "&Next"
      Height          =   495
      Left            =   4560
      TabIndex        =   9
      Top             =   2640
      Width           =   855
   End
   Begin VB.CommandButton cmdPrev 
      Caption         =   "&Prev"
      Height          =   495
      Left            =   3480
      TabIndex        =   8
      Top             =   2640
      Width           =   855
   End
   Begin VB.CommandButton cmdFirst 
      Caption         =   "&First"
      Height          =   495
      Left            =   2400
      TabIndex        =   7
      Top             =   2640
      Width           =   855
   End
   Begin VB.TextBox txtSubmitDate 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3720
      TabIndex        =   6
      Top             =   2160
      Width           =   2175
   End
   Begin VB.TextBox txtPurchaseDate 
      Height          =   285
      Left            =   3720
      TabIndex        =   5
      Top             =   1800
      Width           =   2175
   End
   Begin VB.TextBox txtDescription 
      Height          =   285
      Left            =   3720
      TabIndex        =   4
      Top             =   1440
      Width           =   2175
   End
   Begin VB.TextBox txtExpenseType 
      Height          =   285
      Left            =   3720
      TabIndex        =   2
      Top             =   720
      Width           =   2175
   End
   Begin VB.TextBox txtEmployeeId 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3720
      TabIndex        =   1
      Top             =   360
      Width           =   2175
   End
   Begin VB.TextBox txtExpenseId 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3720
      TabIndex        =   0
      Top             =   0
      Width           =   2175
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Employee:"
      Height          =   195
      Left            =   2400
      TabIndex        =   17
      Top             =   360
      Width           =   735
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "Submission Date:"
      Height          =   195
      Left            =   2400
      TabIndex        =   16
      Top             =   2160
      Width           =   1230
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "Purchase Date:"
      Height          =   195
      Left            =   2400
      TabIndex        =   15
      Top             =   1800
      Width           =   1110
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "Description:"
      Height          =   195
      Left            =   2400
      TabIndex        =   14
      Top             =   1440
      Width           =   840
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "Amount Spent:"
      Height          =   195
      Left            =   2400
      TabIndex        =   13
      Top             =   1080
      Width           =   1050
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "Expense Type:"
      Height          =   195
      Left            =   2400
      TabIndex        =   12
      Top             =   720
      Width           =   1065
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Expense ID:"
      Height          =   195
      Left            =   2400
      TabIndex        =   11
      Top             =   0
      Width           =   870
   End
   Begin VB.Menu mnuFile 
      Caption         =   "&File"
      Begin VB.Menu mnuFileExit 
         Caption         =   "E&xit"
      End
   End
End
Attribute VB_Name = "frmExpClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private expDetailParam As New expDetailParam

Private Sub cmdFirst_Click()
' Positions to first record in recordset and displays values

    Dim strResponse As String
    
    strResponse = expDetailParam.MoveFirst
    If "OK" <> strResponse Then
        MsgBox strResponse
    Else
        Call ReadObjectValues
    End If

End Sub

Private Sub cmdLast_Click()
' Positions to last record in recordset and displays values

    Dim strResponse As String
    
    strResponse = expDetailParam.MoveLast
    If "OK" <> strResponse Then
        MsgBox strResponse
    Else
        Call ReadObjectValues
    End If

End Sub



Private Sub cmdNext_Click()
' Positions to Next record in recordset and displays values

    Dim strResponse As String
    
    strResponse = expDetailParam.MoveNext
    If "OK" <> strResponse Then
        MsgBox strResponse
    Else
        Call ReadObjectValues
    End If


End Sub

Private Sub cmdPrev_Click()
' Positions to Previous record in recordset and displays values

    Dim strResponse As String
    
    strResponse = expDetailParam.MovePrev
    If "OK" <> strResponse Then
        MsgBox strResponse
    Else
        Call ReadObjectValues
    End If


End Sub

Private Sub cmdSetEmployee_Click()
' Sets Employee ID textbox and initiates new query for expenses
' for the selected employee
    Dim strResponse As String
    
    On Error GoTo QueryError
    
    txtEmployeeId.Text = dbgExpEmployee.Text
    expDetailParam.strEmpToQuery = dbgExpEmployee.Text
    strResponse = expDetailParam.MoveFirst
    If "OK" <> strResponse Then
        MsgBox strResponse
    Else
        Call ReadObjectValues
    End If
    
    Exit Sub
    
QueryError:
    MsgBox Err.Description & Chr(13) & "from " & Err.Source & " -- Number: " & CStr(Err.Number)
    Exit Sub
    
End Sub


Private Sub Form_Load()
' Get the ActiveX object to open its database and position
' to the first record
    Dim strDbName As String
    Dim strResponse As String
    
    On Error GoTo LoadError
    
    strDbName = App.Path
    strDbName = strDbName & "\Expense.mdb"
    expDetailParam.strDbName = strDbName
    strResponse = expDetailParam.MoveFirst
    If "OK" <> strResponse Then
        MsgBox strResponse
    Else
        Call ReadObjectValues
    End If
    
    Exit Sub
LoadError:
    MsgBox Err.Description & Chr(13) & "from " & Err.Source & " -- Number: " & CStr(Err.Number)
    Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
    
    Set expDetailParam = Nothing
    
End Sub

Private Sub ReadObjectValues()
' Read the object values into the form fields

    txtExpenseId.Text = CStr(expDetailParam.lngExpenseId)
    txtEmployeeId.Text = expDetailParam.strEmployeeId
    txtExpenseType.Text = expDetailParam.strExpenseType
    txtDescription.Text = expDetailParam.strDescription
    mskAmountSpent.Text = CStr(expDetailParam.curAmountSpent)
    txtPurchaseDate.Text = CStr(expDetailParam.dtmDatePurchased)
    txtSubmitDate.Text = CStr(expDetailParam.dtmDateSubmitted)

End Sub

Private Sub mnuFileExit_Click()

    Unload Me

End Sub

⌨️ 快捷键说明

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