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

📄 frmkhcx.frm

📁 以前写的一个销售的管理系统,是牙刷销存管理系统,有销售,进货等功能,刚学VB时写的
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form frmkhcx 
   Caption         =   "客户查询"
   ClientHeight    =   8595
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   11880
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8595
   ScaleWidth      =   11880
   StartUpPosition =   3  '窗口缺省
   WindowState     =   2  'Maximized
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "xsys"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   1  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   2760
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   8160
      Visible         =   0   'False
      Width           =   2055
   End
   Begin VB.Frame Frame1 
      Caption         =   "客户查询"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   6975
      Left            =   840
      TabIndex        =   0
      Top             =   840
      Width           =   10095
      Begin VB.CommandButton Command3 
         Caption         =   "打  印"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   8040
         TabIndex        =   6
         Top             =   720
         Width           =   1215
      End
      Begin VB.CommandButton Command2 
         Caption         =   "返  回"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   6480
         TabIndex        =   3
         Top             =   720
         Width           =   1215
      End
      Begin VB.CommandButton Command1 
         Caption         =   "查  询"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   4920
         TabIndex        =   2
         Top             =   720
         Width           =   1215
      End
      Begin VB.TextBox txtid 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2640
         TabIndex        =   1
         Top             =   720
         Width           =   2055
      End
      Begin MSDBGrid.DBGrid DBGrid1 
         Bindings        =   "frmkhcx.frx":0000
         Height          =   5055
         Left            =   1080
         OleObjectBlob   =   "frmkhcx.frx":0014
         TabIndex        =   4
         Top             =   1680
         Width           =   8175
      End
      Begin VB.Label Label1 
         Caption         =   "客户编号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   495
         Left            =   1080
         TabIndex        =   5
         Top             =   720
         Width           =   1455
      End
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   0
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
End
Attribute VB_Name = "frmkhcx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
  DefaultType = dbUseODBC
  Dim db As Database
  Dim wk As Workspace
  Dim sql As String
  Set wk = DBEngine.Workspaces(0)
  Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
  wk.BeginTrans
  If txtid = "" Then
     sql = "select 客户编号,单位名称,客户简称,客户地址,电话号码,传真号码 from khk"
     Data1.RecordSource = sql
     Data1.Refresh
  Else
     sql = "select 客户编号,单位名称,客户简称,客户地址,电话号码,传真号码 from khk where 客户编号='" + txtid.Text + "'"
     Data1.RecordSource = sql
     Data1.Refresh
  End If
  db.Close
End Sub

Private Sub Command2_Click()
  Unload Me
  frmmenu.Show
End Sub

Private Sub Command3_Click()
  DefaultType = dbUseODBC
  Dim db As Database
  Dim rs1 As Recordset
  Dim wk As Workspace
  Dim sql As String
  Set wk = DBEngine.Workspaces(0)
  Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
  wk.BeginTrans
  CommonDialog1.ShowPrinter
     Printer.Orientation = vbPRORPortrait
     Printer.PaperSize = vbPRPSA4
     Printer.ScaleMode = vbMillimeters
     Printer.FontName = "宋体"
     Printer.FontSize = 18
     sql = "select * from khk"
     Set rs1 = db.OpenRecordset(sql, dbOpenDynaset, dbwrite, dbOptimistic)
     Printer.CurrentX = 60
     Printer.CurrentY = 15
     Printer.Print "扬州市兴盛牙刷厂客户表"
     Printer.Line (50, 22)-(140, 22)
     Printer.Line (50, 23)-(140, 23)
     rs1.MoveFirst
     Printer.FontSize = 10
     Printer.CurrentX = 5.5
     Printer.CurrentY = 31
     Printer.Line (6, 41.5)-(200, 41.5)
     Printer.CurrentX = 5
     Printer.CurrentY = 42
     Printer.Line (6, 42)-(6, 47)
     Printer.CurrentX = 7
     Printer.CurrentY = 42
     Printer.Print "客户编号"
     Printer.CurrentX = 19
     Printer.CurrentY = 42
     Printer.Line (22, 42)-(22, 47)
     Printer.CurrentX = 23
     Printer.CurrentY = 42
     Printer.Print "   客 户 名 称   "
     Printer.CurrentX = 59
     Printer.CurrentY = 42
     Printer.Line (60, 42)-(60, 47)
     Printer.CurrentX = 61
     Printer.CurrentY = 42
     Printer.Print "客户简称"
     Printer.CurrentX = 77
     Printer.CurrentY = 42
     Printer.Line (78, 42)-(78, 47)
     Printer.CurrentX = 79
     Printer.CurrentY = 42
     Printer.Print "        客 户 地 址    "
     Printer.CurrentX = 139
     Printer.CurrentY = 42
     Printer.Line (140, 42)-(140, 47)
     Printer.CurrentX = 141
     Printer.CurrentY = 42
     Printer.Print " 联系电话 "
     Printer.CurrentX = 169
     Printer.CurrentY = 42
     Printer.Line (170, 42)-(170, 47)
     Printer.CurrentX = 171
     Printer.CurrentY = 42
     Printer.Print " 传    真 "
     Printer.CurrentX = 199
     Printer.CurrentY = 42
     Printer.Line (200, 42)-(200, 47)
     Printer.Line (5.75, 47)-(200, 47)
     CurrentY = 47
     Do While rs1.EOF <> True
1         Printer.FontSize = 10
          CurrentX = 5.75
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          CurrentX = CurrentX + 1
          Printer.CurrentX = CurrentX
          Printer.CurrentY = CurrentY + 1
          Printer.Print rs1.Fields("客户编号")
          CurrentX = CurrentX + 15
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          CurrentX = CurrentX + 1
          Printer.CurrentX = CurrentX
          Printer.CurrentY = CurrentY + 1
          Printer.Print rs1.Fields("单位名称")
          CurrentX = CurrentX + 37
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          CurrentX = CurrentX + 1
          Printer.CurrentX = CurrentX
          Printer.CurrentY = CurrentY + 1
          Printer.Print rs1.Fields("客户简称")
          CurrentX = CurrentX + 17
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          CurrentX = CurrentX + 1
          Printer.CurrentX = CurrentX
          Printer.CurrentY = CurrentY + 1
          Printer.Print rs1.Fields("客户地址")
          CurrentX = CurrentX + 61
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          CurrentX = CurrentX + 1
          Printer.CurrentX = CurrentX
          Printer.CurrentY = CurrentY + 1
          Printer.Print rs1.Fields("电话号码")
          CurrentX = CurrentX + 29
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          CurrentX = CurrentX + 1
          Printer.CurrentX = CurrentX
          Printer.CurrentY = CurrentY + 1
          Printer.Print rs1.Fields("传真号码")
          CurrentX = CurrentX + 29
          Printer.Line (CurrentX, CurrentY)-(CurrentX, CurrentY + 5)
          Printer.Line (5.75, CurrentY + 5)-(200, CurrentY + 5)
          CurrentY = CurrentY + 5
          rs1.MoveNext
          If CurrentY >= 250 Then
             Printer.NewPage
             CurrentY = 15
             Printer.Line (5.75, CurrentY)-(200, CurrentY)
             GoTo 1
          End If
          If rs1.EOF = True Then
             Exit Do
          End If
   Loop
   'Printer.Line (5.75, CurrentY + 5)-(200, CurrentY + 5)
   Printer.EndDoc
   rs1.Close
  db.Close
End Sub

⌨️ 快捷键说明

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