📄 main_htgl_chgl.frm
字号:
EndProperty
BeginProperty Column04
ColumnWidth = 1800
EndProperty
BeginProperty Column05
ColumnWidth = 14.74
EndProperty
BeginProperty Column06
ColumnWidth = 734.74
EndProperty
BeginProperty Column07
ColumnWidth = 1379.906
EndProperty
BeginProperty Column08
ColumnWidth = 14.74
EndProperty
BeginProperty Column09
ColumnWidth = 14.74
EndProperty
BeginProperty Column10
ColumnWidth = 14.74
EndProperty
BeginProperty Column11
ColumnWidth = 14.74
EndProperty
BeginProperty Column12
ColumnWidth = 14.74
EndProperty
EndProperty
End
Begin VB.TextBox text1
BackColor = &H00FF8080&
BorderStyle = 0 'None
Height = 225
Left = 330
TabIndex = 0
Top = 1230
Visible = 0 'False
Width = 2085
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 810
Left = -210
TabIndex = 9
Top = 1680
Visible = 0 'False
Width = 3135
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 180
Top = 240
Width = 1905
_ExtentX = 3360
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=CYGLXT"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=CYGLXT"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 商品基础信息表 "
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Begin VB.CommandButton ComEnd
BackColor = &H00C0C0C0&
Height = 360
Left = 9945
Picture = "main_htgl_chgl.frx":031F
Style = 1 'Graphical
TabIndex = 7
Top = 5190
Width = 1275
End
Begin VB.CommandButton Comdy
BackColor = &H00C0C0C0&
Height = 360
Left = 8670
Picture = "main_htgl_chgl.frx":1CEF
Style = 1 'Graphical
TabIndex = 6
Top = 5190
Width = 1275
End
Begin VB.CommandButton Comqx
BackColor = &H00C0C0C0&
Enabled = 0 'False
Height = 360
Left = 7395
Picture = "main_htgl_chgl.frx":3603
Style = 1 'Graphical
TabIndex = 5
Top = 5190
Width = 1275
End
Begin VB.CommandButton Combc
BackColor = &H00C0C0C0&
Enabled = 0 'False
Height = 360
Left = 6120
Picture = "main_htgl_chgl.frx":50A6
Style = 1 'Graphical
TabIndex = 4
Top = 5190
Width = 1275
End
Begin VB.CommandButton Comdj
BackColor = &H00C0C0C0&
Height = 360
Left = 4830
Picture = "main_htgl_chgl.frx":6B4B
Style = 1 'Graphical
TabIndex = 3
Top = 5190
Width = 1275
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3585
Left = 45
TabIndex = 1
Top = 945
Width = 11160
_ExtentX = 19685
_ExtentY = 6324
_Version = 393216
Rows = 1
Cols = 1
FixedRows = 0
FixedCols = 0
BackColor = 16777215
BackColorFixed = 12632256
ForeColorSel = 16777215
BackColorBkg = 16777215
GridColorFixed = 16777215
Enabled = 0 'False
FocusRect = 2
ScrollBars = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Frame Frame7
Height = 510
Left = 75
TabIndex = 20
Top = 315
Width = 7305
Begin VB.ComboBox jsr
Height = 300
Left = 840
TabIndex = 22
Text = "Combo2"
Top = 150
Width = 2055
End
Begin VB.ComboBox ck
Height = 300
Left = 3630
TabIndex = 21
Text = "Combo2"
Top = 150
Width = 2055
End
Begin VB.Label Label19
BackStyle = 0 'Transparent
Caption = "经 手 人"
Height = 315
Left = 75
TabIndex = 24
Top = 210
Width = 720
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "仓 库 "
Height = 225
Left = 2925
TabIndex = 23
Top = 210
Width = 900
End
End
Begin VB.Label wfje
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 210
Left = 8655
TabIndex = 2
Top = 5865
Visible = 0 'False
Width = 1455
End
End
Attribute VB_Name = "main_htgl_chgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'定义数据集对象
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim rs6 As New ADODB.Recordset
'定义行数和列数
Dim i As Integer
Dim j As Integer
Private Sub Form_Activate()
'初始化出库日期
rkrq.text = Date
'添加经手人列表
rs1.Open "select 员工姓名 from 员工信息表 group by 员工姓名", cnn, adOpenKeyset, adLockOptimistic
If rs1.BOF = False Then rs1.MoveFirst
For i = 0 To rs1.RecordCount - 1
jsr.AddItem (Trim(rs1.Fields("员工姓名")))
rs1.MoveNext
Next i
If jsr.ListCount > 0 Then jsr.ListIndex = 0
rs1.Close
'添加仓库列表
rs2.Open "select 仓库名称 from 仓库信息表 group by 仓库名称", cnn, adOpenKeyset, adLockOptimistic
If rs2.BOF = False Then rs2.MoveFirst
For i = 0 To rs2.RecordCount - 1
ck.AddItem (Trim(rs2.Fields("仓库名称")))
rs2.MoveNext
Next i
If ck.ListCount > 0 Then ck.ListIndex = 0
rs2.Close
rkrq.Enabled = False
ph.Enabled = False
grid1.Visible = False
Me.Caption = Me.Caption & " " & frm_main.St1.Panels(3).text
End Sub
Private Sub Form_Load()
'定义MSFlexGrid1表的总行数、总列数
MSFlexGrid1.Rows = 102
MSFlexGrid1.Cols = 8
'定义MSFlexGrid1表的宽度
MSFlexGrid1.ColWidth(0) = 12 * 25 * 1.5
MSFlexGrid1.ColWidth(1) = 12 * 25 * 8
MSFlexGrid1.ColWidth(2) = 12 * 25 * 4
MSFlexGrid1.ColWidth(3) = 12 * 25 * 2.5
MSFlexGrid1.ColWidth(4) = 12 * 25 * 3
MSFlexGrid1.ColWidth(5) = 12 * 25 * 3
MSFlexGrid1.ColWidth(6) = 12 * 25 * 4
MSFlexGrid1.ColWidth(7) = 12 * 25 * 10
'设置固定行、列
MSFlexGrid1.FixedRows = 1
MSFlexGrid1.FixedCols = 1
'定义MSFlexGrid1表的表头
MSFlexGrid1.TextMatrix(0, 0) = "序号"
MSFlexGrid1.TextMatrix(0, 1) = "商品名称"
MSFlexGrid1.TextMatrix(0, 2) = "商品编号"
MSFlexGrid1.TextMatrix(0, 3) = "单位"
MSFlexGrid1.TextMatrix(0, 4) = "单价"
MSFlexGrid1.TextMatrix(0, 5) = "数量"
MSFlexGrid1.TextMatrix(0, 6) = "金额"
MSFlexGrid1.TextMatrix(0, 7) = "备注"
'定义MSFlexGrid1表的列序号
For i = 1 To 101
MSFlexGrid1.TextMatrix(i, 0) = i
Next i
'设置入库日期等于当前系统日期
rkrq.text = Date
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub ck_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then '按回车键焦点到MSFlexGrid1表格的第一行第一列中,text1输入框可见并获得焦点
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 1
text1.Visible = True
text1.SetFocus
End If
End Sub
Private Sub grid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Adodc1.Recordset.RecordCount > 0 Then '判断是否有记录
If Adodc1.Recordset.Fields("本级名称") <> "" Then
'赋值给MSFlexGrid1表格
If Adodc1.Recordset.Fields("本级名称") <> "" Then MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1) = Trim(Adodc1.Recordset.Fields("本级名称"))
If Adodc1.Recordset.Fields("商品编号") <> "" Then MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2) = Trim(Adodc1.Recordset.Fields("商品编号"))
If Adodc1.Recordset.Fields("单位") <> "" Then MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3) = Trim(Adodc1.Recordset.Fields("单位"))
If Adodc1.Recordset.Fields("单价") <> "" Then MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4) = Adodc1.Recordset.Fields("单价")
'赋值给text1
text1.text = MSFlexGrid1.text
text1.SetFocus
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -