📄 frmxiugai.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmxiugai
BorderStyle = 3 'Fixed Dialog
Caption = "货品资料修改"
ClientHeight = 7275
ClientLeft = 45
ClientTop = 405
ClientWidth = 10005
Icon = "frmxiugai.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7275
ScaleWidth = 10005
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
Caption = "搜索条件"
Height = 735
Left = 120
TabIndex = 5
Top = 0
Width = 5955
Begin VB.ComboBox cmbCha
Height = 300
Left = 120
Style = 2 'Dropdown List
TabIndex = 9
Top = 300
Width = 1515
End
Begin VB.TextBox txtCha
Height = 300
Left = 1680
TabIndex = 8
Top = 300
Width = 1515
End
Begin VB.CommandButton cmdcha
Caption = "查找(&S)"
Height = 345
Left = 3240
TabIndex = 7
Top = 285
Width = 1215
End
Begin VB.CommandButton cmdQuan
Caption = "全部记录(&A)"
Height = 345
Left = 4560
TabIndex = 6
Top = 285
Width = 1215
End
End
Begin VB.CommandButton cmdModify
Caption = "修改(&M)"
Height = 345
Left = 6120
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.CommandButton cmdDel
Caption = "删除(&D)"
Height = 345
Left = 7440
TabIndex = 3
Top = 240
Width = 1215
End
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 345
Left = 8760
TabIndex = 2
Top = 240
Width = 1155
End
Begin VB.Frame Frame1
Caption = "搜索结果"
Height = 6375
Left = 120
TabIndex = 0
Top = 840
Width = 9795
Begin MSFlexGridLib.MSFlexGrid Grid1
Height = 6075
Left = 120
TabIndex = 1
Top = 240
Width = 9555
_ExtentX = 16854
_ExtentY = 10716
_Version = 393216
Cols = 13
ScrollTrack = -1 'True
FocusRect = 0
SelectionMode = 1
AllowUserResizing= 3
Appearance = 0
End
End
End
Attribute VB_Name = "frmxiugai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Id As String
Dim strsql As String
Private Sub cmdclose_Click()
Unload Me
End Sub
Private Sub cmbCha_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtcha.SetFocus
End If
End Sub
Private Sub cmdcha_Click() '查询按钮
Dim rs As New ADODB.Recordset
Select Case cmbCha.ListIndex
Case 0
strsql = "select " & sqlZiduan & " from Huopin where hNo like '%" & Trim(txtcha.Text) & "%' order by hNo"
Case 1
strsql = "select " & sqlZiduan & " from Huopin where hLeibie like '%" & Trim(txtcha.Text) & "%' order by hLeibie"
Case 2
strsql = "select " & sqlZiduan & " from Huopin where hPinpai like '%" & Trim(txtcha.Text) & "%' order by hPinpai"
Case 3
strsql = "select " & sqlZiduan & " from Huopin where hName like '%" & Trim(txtcha.Text) & "%' order by hName"
Case 4
strsql = "select " & sqlZiduan & " from Huopin where hGuige like '%" & Trim(txtcha.Text) & "%' order by hGuige"
Case 5
strsql = "select " & sqlZiduan & " from Huopin where hRukujia like '%" & Trim(txtcha.Text) & "%' order by hRukujia"
End Select
rs.open strsql, cn
fuzhi Grid1, rs
End Sub
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim i As Integer
For i = 0 To UBound(ChahuoStr)
cmbCha.AddItem ChahuoStr(i, 0)
Next i
cmbCha.ListIndex = 0
strsql = "select " & sqlZiduan & " from Huopin where hNo=''"
rs.open strsql, cn
fuzhi Grid1, rs
End Sub
Private Sub cmdQuan_Click()
Dim rs As New ADODB.Recordset
rs.open "select " & sqlZiduan & " from Huopin order by hNo", cn
fuzhi Grid1, rs
End Sub
Private Sub Grid1_DblClick()
If Grid1.TextMatrix(Grid1.Row, 0) <> "" Then
cmdModify_Click
End If
End Sub
Private Sub cmddel_Click()
If Grid1.TextMatrix(Grid1.Row, 0) = "" Then
MsgBox "没有可以删除的记录。", 48, "提示信息"
Exit Sub
End If
If MsgBox("您确实要删除这条记录吗?", 36, "提示信息") = vbNo Then
Exit Sub
End If
cn.Execute "delete from Huopin where ID=" & Grid1.TextMatrix(Grid1.Row, 0)
If Grid1.rows = 2 Then
Grid1.rows = 1
Grid1.rows = 2
Else
Grid1.RemoveItem Grid1.Row
End If
End Sub
Private Sub cmdModify_Click()
Dim rs As New ADODB.Recordset
Dim i As Integer
If Grid1.TextMatrix(Grid1.Row, 0) = "" Then
MsgBox "没有可以修改的记录!", 48, "信息提示"
Exit Sub
End If
frmmodhuo.Id = Grid1.TextMatrix(Grid1.Row, 0)
frmmodhuo.Show 1
rs.open "select " & sqlZiduan & " from Huopin where ID=" & Grid1.TextMatrix(Grid1.Row, 0), cn
For i = 0 To rs.Fields.Count - 1
Grid1.TextMatrix(Grid1.Row, i) = rs.Fields(i).Value
Next i
End Sub
Private Sub txtcha_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdcha_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -