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

📄 form45.frm

📁 我用VB开发的饲料经营进销存管理程序,包含购入、售出管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form45 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Form45"
   ClientHeight    =   3885
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5445
   LinkTopic       =   "Form45"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3885
   ScaleWidth      =   5445
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   440
      Left            =   1920
      TabIndex        =   1
      Top             =   480
      Width           =   2370
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   440
      Left            =   1920
      TabIndex        =   2
      Top             =   1080
      Width           =   2370
   End
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   1920
      TabIndex        =   3
      Text            =   "Combo1"
      Top             =   1680
      Width           =   2415
   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            =   1560
      TabIndex        =   0
      Top             =   2520
      Width           =   1935
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "帐单号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   840
      TabIndex        =   6
      Top             =   600
      Width           =   960
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "年  份:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   840
      TabIndex        =   5
      Top             =   1200
      Width           =   960
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "品  种:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   840
      TabIndex        =   4
      Top             =   1680
      Width           =   840
   End
End
Attribute VB_Name = "Form45"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    If Combo1.Text = "" Then
        MsgBox ("品种不能为空!")
        Combo1.SetFocus
        GoSub exit_Command1_Click
    End If
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Dim rs1 As ADODB.Recordset
    Set cnn1 = New ADODB.Connection
    cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
    Set cmd1 = New ADODB.Command
    SQL = "select count(*),max(编号) from 购入帐单品种表"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    rs1.MoveFirst
    If rs1.Fields(0) = 0 Then
        t_max_number = 0
    Else
        t_max_number = rs1.Fields(1) + 1
    End If

    SQL = "INSERT INTO 购入帐单品种表(编号,帐单号, 年份,品种)" & _
          " VALUES ( " & t_max_number & "," & "'" & Text2.Text & "'" & "," & _
          Text3.Text & "," & "'" & Combo1.Text & "'" & ")"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
        .Execute
    End With
    cnn1.Close
    Set cnn1 = Nothing
    MsgBox ("数据保存成功")
    Combo1.Text = ""
    Combo1.SetFocus
exit_Command1_Click:
End Sub

Private Sub Form_Load()
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Dim rs1 As ADODB.Recordset
    Set cnn1 = New ADODB.Connection
    cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
    Set cmd1 = New ADODB.Command
    SQL = "select 品种  from 品种类型表  order by 品种"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    rs1.MoveFirst
    i = 0
    While Not rs1.EOF
        Combo1.AddItem rs1.Fields(0), i
        rs1.MoveNext
        i = i + 1
    Wend
    Combo1.Text = ""
    Text2.Text = g_reckoning
    Text3.Text = g_year
    cnn1.Close
    Set cnn1 = Nothing
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Select Case g_form
        Case "form43"
            Form43.Show
        Case "form45"
            g_form = "form37"
            Form3.Show
    End Select
End Sub

Private Sub Text2_GotFocus()
    Combo1.SetFocus
End Sub

Private Sub Text3_GotFocus()
    Combo1.SetFocus
End Sub

⌨️ 快捷键说明

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