📄 frmxcp.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmXCPbm
BorderStyle = 3 'Fixed Dialog
Caption = "编码维护---新产品编码"
ClientHeight = 3165
ClientLeft = 1095
ClientTop = 330
ClientWidth = 5775
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3165
ScaleWidth = 5775
StartUpPosition = 1 '所有者中心
Begin VB.ListBox LstCpbm
BackColor = &H00C0FFFF&
Height = 1140
Left = 1560
TabIndex = 18
Top = 1200
Visible = 0 'False
Width = 2730
End
Begin MSComCtl2.DTPicker DTPicker1
DataField = "日期"
Height = 300
Left = 2220
TabIndex = 17
Top = 360
Width = 2730
_ExtentX = 4815
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 24510465
CurrentDate = 36169
End
Begin VB.PictureBox picButtons
Align = 2 'Align Bottom
Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 300
Left = 0
ScaleHeight = 300
ScaleWidth = 5775
TabIndex = 9
Top = 2565
Width = 5775
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 300
Left = 4675
TabIndex = 14
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdRefresh
Caption = "刷新(&R)"
Height = 300
Left = 3521
TabIndex = 13
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdQuery
Caption = "查询(&Q)"
Height = 300
Left = 2367
TabIndex = 12
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdEdit
Caption = "修改(&E)"
Height = 300
Left = 1213
TabIndex = 11
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdUpdate
Caption = "保存(&S)"
Height = 300
Left = 59
TabIndex = 15
Top = 0
Visible = 0 'False
Width = 1095
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 300
Left = 59
TabIndex = 10
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 300
Left = 1213
TabIndex = 16
Top = 0
Visible = 0 'False
Width = 1095
End
End
Begin VB.PictureBox picStatBox
Align = 2 'Align Bottom
Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 300
Left = 0
ScaleHeight = 300
ScaleWidth = 5775
TabIndex = 3
Top = 2865
Width = 5775
Begin VB.CommandButton cmdLast
Height = 300
Left = 4545
Picture = "frmXCP.frx":0000
Style = 1 'Graphical
TabIndex = 7
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.CommandButton cmdNext
Height = 300
Left = 4200
Picture = "frmXCP.frx":0342
Style = 1 'Graphical
TabIndex = 6
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.CommandButton cmdPrevious
Height = 300
Left = 345
Picture = "frmXCP.frx":0684
Style = 1 'Graphical
TabIndex = 5
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.CommandButton cmdFirst
Height = 300
Left = 0
Picture = "frmXCP.frx":09C6
Style = 1 'Graphical
TabIndex = 4
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.Label lblStatus
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Height = 285
Left = 690
TabIndex = 8
Top = 0
Width = 3360
End
End
Begin VB.TextBox txtFields
DataField = "新产品编码"
Enabled = 0 'False
Height = 285
Left = 2160
TabIndex = 2
Top = 885
Width = 2775
End
Begin VB.TextBox txtCpmc
Enabled = 0 'False
Height = 285
Left = 2160
TabIndex = 21
Top = 1440
Width = 2775
End
Begin VB.TextBox txtGg
DataField = "新产品编码"
Enabled = 0 'False
Height = 285
Left = 2160
TabIndex = 22
Top = 2040
Width = 2775
End
Begin VB.Label Label2
Caption = "规格:"
Height = 255
Left = 960
TabIndex = 20
Top = 2040
Width = 1215
End
Begin VB.Label Label1
Caption = "产品名称:"
Height = 255
Left = 960
TabIndex = 19
Top = 1440
Width = 1095
End
Begin VB.Label lblLabels
Caption = "新产品编码:"
Height = 255
Index = 1
Left = 930
TabIndex = 1
Top = 900
Width = 1080
End
Begin VB.Label lblLabels
Caption = "日期:"
Height = 255
Index = 0
Left = 915
TabIndex = 0
Top = 465
Width = 1080
End
End
Attribute VB_Name = "frmXCPbm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'实现新产品编码表的维护
Option Explicit
Dim WithEvents adoPrimaryRS As Recordset
Attribute adoPrimaryRS.VB_VarHelpID = -1
Dim mbChangedByCode As Boolean
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Dim mbDataChanged As Boolean
Dim Rs As New Recordset
Dim Rs1 As New Recordset
Dim strzc As String
Dim rsCpbm As New Recordset
'写数据模块
Private Sub GetData()
On Err GoTo getdataErr
DTPicker1.Value = adoPrimaryRS(0)
txtFields = adoPrimaryRS(1)
txtCpmc = adoPrimaryRS(2)
txtGg = adoPrimaryRS(3)
Exit Sub
getdataErr:
MsgBox Err.Description
End Sub
'查询
Private Sub cmdQuery_Click()
Me.Hide
frmXcpbmcx.Show
End Sub
'回车移光标
Private Sub DTPicker1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
'保证双击查询窗口CELL时切换到维护界面时当前记录的一致性
Private Sub Form_Activate()
If Me.Tag <> "" Then
adoPrimaryRS.MoveFirst
adoPrimaryRS.Find ("新产品编码='" & Me.Tag & "'")
End If
GetData ''''''''''向文本框等向用户显示数据的控件中写数据
End Sub
Private Sub Form_Load()
Rs.Open "select 新产品编码,产品名称,规格 from xcp order by 新产品编码", dblgjx, adOpenStatic, adLockOptimistic
Rs1.Open "select 新产品编码 from xcp ", dblgjx, adOpenStatic, adLockOptimistic
If rsCpbm.State = adStateOpen Then rsCpbm.Close
rsCpbm.Open "select 产品编码,产品名称,规格 from cpbm ", dblgjx, adOpenStatic, adLockOptimistic
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from XCP Order by 日期", dblgjx, adOpenStatic, adLockOptimistic
mbDataChanged = False
GetData
End Sub
Private Sub Form_Resize()
On Error Resume Next
lblStatus.Width = Me.Width - 1500
cmdNext.Left = lblStatus.Width + 700
cmdLast.Left = cmdNext.Left + 340
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -