📄 frminvinfo.frm
字号:
VERSION 5.00
Object = "{0D6234D1-DBA2-11D1-B5DF-0060976089D0}#6.0#0"; "TODG6.OCX"
Begin VB.Form frmInvInfo
Caption = "物料检索"
ClientHeight = 5070
ClientLeft = 60
ClientTop = 345
ClientWidth = 6870
LinkTopic = "Form1"
ScaleHeight = 5070
ScaleWidth = 6870
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
BackColor = &H00C0FFC0&
Height = 5055
Left = 0
ScaleHeight = 4995
ScaleWidth = 6795
TabIndex = 0
Top = 0
Width = 6855
Begin TrueOleDBGrid60.TDBGrid TDBGrid1
Height = 4215
Left = 0
OleObjectBlob = "frmInvInfo.frx":0000
TabIndex = 3
Top = 720
Width = 6735
End
Begin VB.TextBox txtLike
Height = 495
Left = 1440
TabIndex = 2
Top = 120
Width = 3975
End
Begin VB.Label lblLike
BackColor = &H00C0FFC0&
Caption = "序号:"
Height = 495
Left = 120
TabIndex = 1
Top = 240
Width = 1575
End
End
End
Attribute VB_Name = "frmInvInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strTxt As String
Private Sub InitTDBGrid()
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select Inventory_ID 序号,description 名称,物料类型=(select A.description as type from Inventory_type A where Inventory.type=A.ID),配码类型=(select B.description from mis_size_type B where Inventory.size_type=B.id),unit 单位,standard_cost 标准成本,avg_cost 平均成本,balance 最终成本,source 来源 from Inventory"
rs.CursorLocation = adUseClient
If rs.State = 0 Then
rs.Open sql, GetCNClient(), adOpenDynamic, adLockOptimistic
End If
Set Me.TDBGrid1.DataSource = rs
Me.TDBGrid1.Refresh
End Sub
Private Sub Form_Load()
InitTDBGrid
End Sub
'Private Sub TDBGrid1_DblClick()
' If Me.TDBGrid1.Col <> 0 Then
' GInventory_ID = Me.TDBGrid1.Columns("Inventory_ID").Value
' If ISGet = False Then
' FrmInventory.Show 1
' Else
' Unload Me
' End If
' End If
'End Sub
Private Sub TDBGrid1_Click()
Me.lblLike.Caption = TDBGrid1.Columns(Me.TDBGrid1.Col).Caption
Select Case Trim(Me.lblLike.Caption)
Case "序号"
strTxt = "Inventory_ID"
Case "名称"
strTxt = "description"
Case "物料类型"
strTxt = "type"
Case "配码类型"
strTxt = "size_type"
Case "单位"
strTxt = "unit"
Case "标准成本"
strTxt = "standard_cost"
Case "平均成本"
strTxt = "avg_cost"
Case "最终成本"
strTxt = "balance"
Case "来源"
strTxt = "source"
End Select
End Sub
Private Sub txtLike_Change()
If Me.txtLike.Text = "" Then
InitTDBGrid
Else
ChangeTDBGrid
End If
End Sub
Private Sub ChangeTDBGrid()
Dim rs As New ADODB.Recordset
Dim sql As String
Dim strLike As String
Select Case Trim(strTxt)
Case "Inventory_ID", "description", "unit", "standard_cost", "avg_cost", "balance", "source"
strLike = strTxt & " like '%" & Trim(Me.txtLike.Text) & "%'"
Case "type"
strLike = strTxt & " in ( select ID from Inventory_type where description like '%" & Trim(Me.txtLike.Text) & "%' )"
Case "size_type"
strLike = strTxt & " in ( select ID from mis_size_type where description like '%" & Trim(Me.txtLike.Text) & "%' )"
End Select
sql = "select Inventory_ID 序号,description 名称,物料类型=(select A.description as type from Inventory_type A where Inventory.type=A.ID),配码类型=(select B.description from mis_size_type B where Inventory.size_type=B.id),unit 单位,standard_cost 标准成本,avg_cost 平均成本,balance 最终成本,source 来源 from Inventory where " & strLike
rs.CursorLocation = adUseClient
If rs.State = 1 Then
rs.Close
End If
rs.Open sql, GetCNClient(), adOpenDynamic, adLockOptimistic
Set Me.TDBGrid1.DataSource = rs
Me.TDBGrid1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -