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

📄 frmlocationsae.frm

📁 Inventory control system
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmLocationsAE 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Routes"
   ClientHeight    =   4905
   ClientLeft      =   2235
   ClientTop       =   2640
   ClientWidth     =   5565
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4905
   ScaleWidth      =   5565
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdAdd 
      Caption         =   "Add"
      Height          =   315
      Left            =   3810
      TabIndex        =   3
      Top             =   1410
      Width           =   495
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "Save"
      Default         =   -1  'True
      Height          =   315
      Left            =   2310
      TabIndex        =   6
      Top             =   4410
      Width           =   1335
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "Cancel"
      Height          =   315
      Left            =   3720
      TabIndex        =   7
      Top             =   4410
      Width           =   1335
   End
   Begin VB.TextBox txtEntry 
      Height          =   315
      Index           =   1
      Left            =   1140
      MaxLength       =   100
      TabIndex        =   1
      Tag             =   "Name"
      Top             =   600
      Width           =   1635
   End
   Begin VB.CommandButton cmdUsrHistory 
      Caption         =   "Modification History"
      Height          =   315
      Left            =   240
      TabIndex        =   5
      Top             =   4410
      Width           =   1680
   End
   Begin Inventory.ctrlLiner ctrlLiner1 
      Height          =   30
      Left            =   210
      TabIndex        =   8
      Top             =   4305
      Width           =   5115
      _ExtentX        =   18389
      _ExtentY        =   53
   End
   Begin MSDataListLib.DataCombo dcRoute 
      Height          =   315
      Left            =   1140
      TabIndex        =   0
      Top             =   240
      Width           =   2745
      _ExtentX        =   4842
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Text            =   ""
   End
   Begin MSComctlLib.ListView lvCities 
      Height          =   2235
      Left            =   1110
      TabIndex        =   4
      Top             =   1770
      Width           =   3225
      _ExtentX        =   5689
      _ExtentY        =   3942
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   4
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Object.Width           =   0
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "Cities"
         Object.Width           =   4683
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "City ID"
         Object.Width           =   0
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   3
         Text            =   "LocationID"
         Object.Width           =   0
      EndProperty
   End
   Begin MSDataListLib.DataCombo dcCities 
      Height          =   315
      Left            =   1110
      TabIndex        =   2
      Top             =   1410
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Text            =   ""
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label2 
      Caption         =   "Cites"
      Height          =   285
      Left            =   1140
      TabIndex        =   11
      Top             =   1140
      Width           =   705
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Desc"
      Height          =   240
      Index           =   0
      Left            =   330
      TabIndex        =   10
      Top             =   600
      Width           =   675
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Route"
      Height          =   240
      Index           =   11
      Left            =   300
      TabIndex        =   9
      Top             =   240
      Width           =   735
   End
End
Attribute VB_Name = "frmLocationsAE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Public State                As FormState 'Variable used to determine on how the form used
Public PK                   As Long 'Variable used to get what record is going to edit
Public srcText              As TextBox 'Used in pop-up mode
Public srcTextAdd           As TextBox 'Used in pop-up mode -> Display the customer address
Public srcTextCP            As TextBox 'Used in pop-up mode -> Display the customer contact person
Public srcTextDisc          As Object  'Used in pop-up mode -> Display the customer Discount (can be combo or textbox)

Dim HaveAction              As Boolean 'Variable used to detect if the user perform some action
Dim rs                      As New Recordset

Dim rsPMeasures             As New Recordset
Dim d()                     As Long     'this array will hold the id of those productunit(s) that will be deleted
Dim b                       As Long   'bookmark to the next element on the arrary d
Dim pm_ID                   As Long   'position of the unit on the list

Private Sub DisplayForEditing()
    On Error GoTo erR
    
    Dim rs1 As New Recordset
    
    rs1.CursorLocation = adUseClient
    rs1.Open "SELECT * FROM qry_Locations WHERE RouteID = " & PK, CN, adOpenStatic, adLockOptimistic
      
    ReDim d(rs1.RecordCount)      're-define array dimension
    
    With rs1
      dcRoute.Text = .Fields("Route")
      txtEntry(1).Text = .Fields("Desc")
    End With
    
    
    'load units under stock
    With lvCities
      dcCities.Text = ""
      Do While Not rs1.EOF
        .ListItems.Add
        .ListItems(.ListItems.Count).SubItems(1) = rs1!City
        .ListItems(.ListItems.Count).SubItems(2) = rs1!CityID
        .ListItems(.ListItems.Count).SubItems(3) = rs1!LocationID
        
        rs1.MoveNext
      Loop
    End With
    
    
    Exit Sub
erR:
        'If err.Number = 94 Then Resume Next
        MsgBox "Error: " & erR.Description, vbExclamation
End Sub

Private Sub cmdAdd_Click()
  
  With lvCities
    If Trim(dcRoute.Text) = "" Or Trim(dcCities.Text) = "" Then Exit Sub
          
    
      If pm_ID = 0 Then
        If Not AlreadyAdded(dcCities.Text) Then
          .ListItems.Add
          .ListItems(.ListItems.Count).SubItems(1) = dcCities.Text
          .ListItems(.ListItems.Count).SubItems(2) = dcCities.BoundText
        End If
      Else
        .ListItems(pm_ID).SubItems(1) = dcCities.Text
        .ListItems(pm_ID).SubItems(2) = dcCities.BoundText
      End If
            
      dcCities.Text = ""
  End With
End Sub

Private Function AlreadyAdded(ByVal City As String) As Boolean
  Dim I As Long
  With lvCities
    For I = 1 To .ListItems.Count
      If .ListItems(I).SubItems(1) = City Then
        .ListItems(I).SubItems(1) = dcCities.Text
        
        dcCities.Text = ""
        AlreadyAdded = True
        Exit Function
      End If
    Next
    
    AlreadyAdded = False
  End With
End Function



Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub ResetFields()
    clearText Me
    dcRoute.Text = ""

⌨️ 快捷键说明

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