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

📄 frmsuppliers.frm

📁 英文版Access数据库编程
💻 FRM
📖 第 1 页 / 共 3 页
字号:
   End
   Begin VB.Label Label1 
      Caption         =   "Address:"
      Height          =   255
      Index           =   2
      Left            =   120
      TabIndex        =   40
      Top             =   1920
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "City:"
      Height          =   255
      Index           =   3
      Left            =   120
      TabIndex        =   39
      Top             =   3000
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "State:"
      Height          =   255
      Index           =   4
      Left            =   120
      TabIndex        =   38
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Country:"
      Height          =   255
      Index           =   5
      Left            =   120
      TabIndex        =   37
      Top             =   2280
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Zip Code:"
      Height          =   255
      Index           =   6
      Left            =   120
      TabIndex        =   36
      Top             =   3360
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Phone (1):"
      Height          =   255
      Index           =   7
      Left            =   120
      TabIndex        =   35
      Top             =   3840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Phone (2):"
      Height          =   255
      Index           =   8
      Left            =   120
      TabIndex        =   34
      Top             =   4200
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Fax (1):"
      Height          =   255
      Index           =   9
      Left            =   4200
      TabIndex        =   33
      Top             =   3840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Fax (2):"
      Height          =   255
      Index           =   10
      Left            =   4200
      TabIndex        =   32
      Top             =   4200
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Credit Limit:"
      Height          =   255
      Index           =   11
      Left            =   120
      TabIndex        =   31
      Top             =   5400
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Credit Term:"
      Height          =   255
      Index           =   12
      Left            =   2760
      TabIndex        =   30
      Top             =   5400
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "Current Balance:"
      Height          =   255
      Index           =   13
      Left            =   5400
      TabIndex        =   29
      Top             =   5400
      Width           =   1215
   End
   Begin VB.Line Line1 
      X1              =   1920
      X2              =   2040
      Y1              =   3960
      Y2              =   3960
   End
   Begin VB.Line Line2 
      X1              =   1920
      X2              =   2040
      Y1              =   4320
      Y2              =   4320
   End
   Begin VB.Line Line3 
      X1              =   6000
      X2              =   6120
      Y1              =   3960
      Y2              =   3960
   End
   Begin VB.Line Line4 
      X1              =   6000
      X2              =   6120
      Y1              =   4320
      Y2              =   4320
   End
   Begin VB.Label lblHidden 
      Height          =   255
      Left            =   3960
      TabIndex        =   28
      Top             =   2280
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "Email:"
      Height          =   255
      Left            =   120
      TabIndex        =   27
      Top             =   4560
      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 Bar01 
         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 Bar02 
         Caption         =   "-"
      End
      Begin VB.Menu mnu_Options_Exit 
         Caption         =   "E&xit"
         Shortcut        =   ^X
      End
   End
   Begin VB.Menu mnu_PO 
      Caption         =   "&Purchase Order"
      Begin VB.Menu mnu_PO_new 
         Caption         =   "&New Purchase Order"
      End
   End
   Begin VB.Menu mnu_Account 
      Caption         =   "&Account"
      Begin VB.Menu mnu_Acc_Adjust 
         Caption         =   "&Adjustment"
      End
   End
End
Attribute VB_Name = "frmSuppliers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub list_Suppliers_ItemClick(ByVal Item As MSComctlLib.ListItem)
If list_Suppliers.ListItems.Count > 0 Then
    If list_Suppliers.SelectedItem.Selected = True Then
        getSupplierInfo list_Suppliers.SelectedItem.Text
    End If
End If
End Sub

Private Sub mnu_Acc_Adjust_Click()
If lblhidden.Caption <> "" Then
    Load frmAdjustment
    frmAdjustment.setAccType "Supplier"
    frmAdjustment.Tag = lblhidden.Caption
    frmAdjustment.Show vbModal
End If
End Sub

Private Sub mnu_Account_Click()
If lblhidden.Caption = "" Then
    mnu_Acc_Adjust.Enabled = False
Else
    mnu_Acc_Adjust.Enabled = True
End If
End Sub

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
getSupplierInfo lblhidden.Caption
End Sub

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub cmdEdit_Click()
If Len(txtSupplierID.Text) > 0 Then
    FormMode Editing
Else
    InfoMsg "Please select a supplier first.", "Missing selection"
End If
End Sub

Private Sub cmdSave_Click()
'Do nothing
If txtSupplierID.Text = "" Then
    ValidMsg "Please enter a supplier ID.", "Missing supplier ID"
    txtSupplierID.SetFocus
ElseIf txtName.Text = "" Then
    ValidMsg "Please enter a supplier name.", "Missing name"
    txtName.SetFocus
ElseIf txtAddress.Text = "" Then
    ValidMsg "Please enter an address for the supplier.", "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 suppRS As Recordset
    RSOpen suppRS, "SELECT * FROM Suppliers WHERE SupplierID='" & lblhidden.Caption & "';", dbOpenDynaset
    If Not suppRS.EOF Then
        suppRS.Edit
        suppRS("SupplierID") = txtSupplierID.Text
        suppRS("Name") = txtName.Text
        suppRS("Address") = txtAddress.Text
        suppRS("Country") = cmbCountry.Text
        suppRS("City") = cmbCity.Text
        suppRS("State") = cmbState.Text
        suppRS("Zip") = txtZip.Text
        suppRS("ACPhone1") = txtPhone1(0).Text
        suppRS("ACPhone2") = txtPhone2(0).Text
        suppRS("ACFax1") = txtFax1(0).Text
        suppRS("ACFax2") = txtFax2(0).Text
        suppRS("Phone1") = txtPhone1(1).Text
        suppRS("Phone2") = txtPhone2(1).Text
        suppRS("Fax1") = txtFax1(1).Text
        suppRS("Fax2") = txtFax2(1).Text
        suppRS("Email") = txtEmail.Text
        suppRS("CreditLimit") = Format$(txtLimit.Text, "#,##0.00")
        suppRS("CreditTerm") = txtTerm.Text
        suppRS.Update
        
        'Insert into systems log
        insertLog "Supplier ID: " & lblhidden.Caption & " account has been updated."
        InfoMsg "Supplier ID: " & lblhidden.Caption & " account has been successfully updated.", "Record saved"
        FormMode Viewing
    End If
    'Close recordsets and free memory
    suppRS.Close
    Set suppRS = Nothing
End If
End Sub

Private Sub Form_Load()
FillComboCountry cmbCountry
FormMode Viewing
Me.WindowState = vbMaximized
getSuppliers
With tb
    .Tabs.Clear
    .Tabs.add , , "Purchases"
    .Tabs.add , , "Payment"
    .Tabs.add , , "All"
    .Tabs(1).Selected = True

⌨️ 快捷键说明

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