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

📄 frmcustomers.frm

📁 英文版Access数据库编程
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      X1              =   6000
      X2              =   6120
      Y1              =   3960
      Y2              =   3960
   End
   Begin VB.Line Line2 
      X1              =   1920
      X2              =   2040
      Y1              =   4320
      Y2              =   4320
   End
   Begin VB.Line Line1 
      X1              =   1920
      X2              =   2040
      Y1              =   3960
      Y2              =   3960
   End
   Begin VB.Label Label1 
      Caption         =   "Current Balance:"
      Height          =   255
      Index           =   13
      Left            =   5400
      TabIndex        =   38
      Top             =   5400
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Credit Term:"
      Height          =   255
      Index           =   12
      Left            =   2760
      TabIndex        =   37
      Top             =   5400
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "Credit Limit:"
      Height          =   255
      Index           =   11
      Left            =   120
      TabIndex        =   36
      Top             =   5400
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Fax (2):"
      Height          =   255
      Index           =   10
      Left            =   4200
      TabIndex        =   35
      Top             =   4200
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Fax (1):"
      Height          =   255
      Index           =   9
      Left            =   4200
      TabIndex        =   34
      Top             =   3840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Phone (2):"
      Height          =   255
      Index           =   8
      Left            =   120
      TabIndex        =   33
      Top             =   4200
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Phone (1):"
      Height          =   255
      Index           =   7
      Left            =   120
      TabIndex        =   32
      Top             =   3840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Zip Code:"
      Height          =   255
      Index           =   6
      Left            =   120
      TabIndex        =   31
      Top             =   3360
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Country:"
      Height          =   255
      Index           =   5
      Left            =   120
      TabIndex        =   30
      Top             =   2280
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "State:"
      Height          =   255
      Index           =   4
      Left            =   120
      TabIndex        =   29
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "City:"
      Height          =   255
      Index           =   3
      Left            =   120
      TabIndex        =   28
      Top             =   3000
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Address:"
      Height          =   255
      Index           =   2
      Left            =   120
      TabIndex        =   27
      Top             =   1920
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Name:"
      Height          =   255
      Index           =   1
      Left            =   2640
      TabIndex        =   26
      Top             =   1560
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "Customer ID:"
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   25
      Top             =   1560
      Width           =   1215
   End
   Begin VB.Menu mnu_Options 
      Caption         =   "&Options"
      Begin VB.Menu mnu_Options_New 
         Caption         =   "&New"
         Shortcut        =   ^N
      End
      Begin VB.Menu mnu_Options_Edit 
         Caption         =   "&Edit"
         Shortcut        =   ^E
      End
      Begin VB.Menu mnu_Bar_01 
         Caption         =   "-"
      End
      Begin VB.Menu mnu_Options_Save 
         Caption         =   "&Save"
         Shortcut        =   ^S
      End
      Begin VB.Menu mnu_Options_Cancel 
         Caption         =   "&Cancel"
      End
      Begin VB.Menu mnu_Bar_02 
         Caption         =   "-"
      End
      Begin VB.Menu mnu_Options_Exit 
         Caption         =   "E&xit"
         Shortcut        =   ^X
      End
   End
   Begin VB.Menu mnu_DO 
      Caption         =   "&Delivery Order"
      Begin VB.Menu mnu_DO_New 
         Caption         =   "&New Delivery Order"
      End
      Begin VB.Menu mnu_DO_Payment 
         Caption         =   "&Payment"
      End
   End
   Begin VB.Menu mnu_Account 
      Caption         =   "&Account"
      Begin VB.Menu mnu_Acc_Adjust 
         Caption         =   "&Adjustments"
      End
   End
End
Attribute VB_Name = "frmCustomers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmbCity_GotFocus()
If cmbCity.Text = "[PLEASE SELECT ONE]" Then
    cmbCity.Text = ""
End If
SelText cmbCity
End Sub

Private Sub cmbCity_LostFocus()
CapCon cmbCity
End Sub

Private Sub cmbCountry_Click()
FillComboState cmbState, cmbCountry.Text
End Sub

Private Sub cmbCountry_GotFocus()
If cmbCountry.Text = "[PLEASE SELECT ONE]" Then
    cmbCountry.Text = ""
End If
SelText cmbCountry
End Sub

Private Sub cmbCountry_LostFocus()
CapCon cmbCountry
End Sub

Private Sub cmbState_GotFocus()
If cmbState.Text = "[PLEASE SELECT ONE]" Then
    cmbState.Text = ""
End If
SelText cmbState
End Sub

Private Sub cmbState_LostFocus()
CapCon cmbState
End Sub

Private Sub cmdCancel_Click()
FormMode Viewing
getCustomerInfo lblHidden.Caption
End Sub

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub cmdEdit_Click()
If txtCustomerID.Text <> "" Then
    FormMode Editing
Else
    InfoMsg "Please select a customer first.", "Missing selection"
End If
End Sub

Private Sub cmdSave_Click()
'Do nothing
If txtCustomerID.Text = "" Then
    ValidMsg "Please enter a customer ID.", "Missing customer ID"
    txtCustomerID.SetFocus
ElseIf txtName.Text = "" Then
    ValidMsg "Please enter a customer name.", "Missing name"
    txtName.SetFocus
ElseIf txtAddress.Text = "" Then
    ValidMsg "Please enter an address for the customer.", "Missing address"
    txtAddress.SetFocus
ElseIf cmbCountry.Text = "" Then
    ValidMsg "Please select or enter a country for the address.", "Missing country"
    cmbCountry.SetFocus
ElseIf cmbState.Text = "" Then
    ValidMsg "Please select or enter a state for the address.", "Missing state"
    cmbState.SetFocus
ElseIf cmbCity.Text = "" Then
    ValidMsg "Please select or enter a city for the address.", "Missing city"
    cmbCity.SetFocus
ElseIf txtZip.Text = "" Then
    ValidMsg "Please enter a zip code for the address.", "Missing zip code"
    txtZip.SetFocus
ElseIf txtPhone1(0).Text = "" Then
    ValidMsg "Please enter the a valid phone number or leave it in 0s.", "Missing phone number"
    txtPhone1(0).SetFocus
ElseIf txtPhone1(1).Text = "" Then
    ValidMsg "Please enter the a valid phone number or leave it in 0s.", "Missing phone number"
    txtPhone1(1).SetFocus
ElseIf txtPhone2(0).Text = "" Then
    ValidMsg "Please enter the a valid phone number or leave it in 0s.", "Missing phone number"
    txtPhone2(0).SetFocus
ElseIf txtPhone2(1).Text = "" Then
    ValidMsg "Please enter the a valid phone number or leave it in 0s.", "Missing phone number"
    txtPhone1(1).SetFocus
ElseIf txtFax1(0).Text = "" Then
    ValidMsg "Please enter the a valid fax number or leave it in 0s.", "Missing fax number"
    txtFax1(0).SetFocus
ElseIf txtFax1(1).Text = "" Then
    ValidMsg "Please enter the a valid fax number or leave it in 0s.", "Missing fax number"
    txtFax1(1).SetFocus
ElseIf txtFax2(0).Text = "" Then
    ValidMsg "Please enter the a valid fax number or leave it in 0s.", "Missing fax number"
    txtFax2(0).SetFocus
ElseIf txtFax2(1).Text = "" Then
    ValidMsg "Please enter the a valid fax number or leave it in 0s.", "Missing fax number"
    txtFax2(1).SetFocus
ElseIf Val(txtLimit.Text) > 999999 Then
    ValidMsg "Please ensure that the credit limit do not exceed $999,999.00.", "Invalid credit limit"
    txtLimit.SetFocus
Else
    'Done with validation
    'Continue with saving
    Dim custRS As Recordset
    RSOpen custRS, "SELECT * FROM Customers WHERE CustomerID='" & lblHidden.Caption & "';", dbOpenDynaset
    If Not custRS.EOF Then
        custRS.Edit
        custRS("CustomerID") = txtCustomerID.Text
        custRS("Name") = txtName.Text
        custRS("Address") = txtAddress.Text
        custRS("Country") = cmbCountry.Text
        custRS("City") = cmbCity.Text
        custRS("State") = cmbState.Text
        custRS("Zip") = txtZip.Text
        custRS("ACPhone1") = txtPhone1(0).Text
        custRS("ACPhone2") = txtPhone2(0).Text
        custRS("ACFax1") = txtFax1(0).Text
        custRS("ACFax2") = txtFax2(0).Text
        custRS("Phone1") = txtPhone1(1).Text
        custRS("Phone2") = txtPhone2(1).Text
        custRS("Fax1") = txtFax1(1).Text
        custRS("Fax2") = txtFax2(1).Text
        custRS("Email") = txtEmail.Text
        custRS("CreditLimit") = Format$(txtLimit.Text, "#,##0.00")
        custRS("CreditTerm") = txtTerm.Text
        custRS.Update
        
        'Insert into systems log
        insertLog "Customer ID: " & lblHidden.Caption & " account has been updated."
        InfoMsg "Customer ID: " & lblHidden.Caption & " account has been successfully updated.", "Record saved"
        FormMode Viewing
    End If
    'Close recordsets and free memory
    custRS.Close
    Set custRS = Nothing
End If
End Sub

Private Sub Form_Load()
FillComboCountry cmbCountry
FormMode Viewing
Me.WindowState = vbMaximized
getCustomers
DisableClose frmCustomers, True
With tb
    .Tabs.Clear
    .Tabs.add , , "Delivery"
    .Tabs.add , , "Payment"
    .Tabs.add , , "All"
    .Tabs(1).Selected = True
End With
If CurrentUser.prvlgAdmin = True Then
    mnu_Account.Visible = True
Else
    mnu_Account.Visible = False
End If
End Sub

Private Sub Form_Resize()
On Error Resume Next
list_Customers.width = Me.ScaleWidth - list_Customers.Left * 2
list_History.width = Me.ScaleWidth - list_History.Left * 2
tb.width = Me.ScaleWidth - tb.Left * 2
tb.height = Me.ScaleHeight - tb.Left * 5
list_History.height = Me.ScaleHeight - list_History.Left * 5
End Sub

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

Private Sub list_Customers_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
With list_Customers '// change to the name of the list view
    Static iLast As Integer, iCur As Integer
    .Sorted = True
    iCur = ColumnHeader.Index - 1
    If iCur = iLast Then .SortOrder = IIf(.SortOrder = 1, 0, 1)
    .SortKey = iCur
    iLast = iCur
End With
End Sub

⌨️ 快捷键说明

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