📄 frmmqsmallgenus.frm
字号:
Picture = "frmMQSmallGenus.frx":12AC7
Key = ""
EndProperty
BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMQSmallGenus.frx":133A1
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmMQSmallGenus"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public mintCurPage As Integer '当前页
Public mintPageSize As Integer '每页多少行
Public mrstDriveRoom As Recordset
Private Sub fg_DblClick()
If fg.TextMatrix(fg.Row, 1) = "" Then
Exit Sub
End If
frmSmallGenus.cboGoodsBigTypeID.ListIndex = getComIndex(frmSmallGenus.cboGoodsBigTypeID, fg.TextMatrix(fg.Row, 1))
frmSmallGenus.txtGoodsSmallTypeID.Text = fg.TextMatrix(fg.Row, 3)
frmSmallGenus.txtGoodsSmallTypeName.Text = fg.TextMatrix(fg.Row, 4)
frmSmallGenus.txtRemark.Text = fg.TextMatrix(fg.Row, 5)
frmSmallGenus.txtGoodsSmallTypeID.Enabled = False
frmSmallGenus.txtGoodsSmallTypeName.Enabled = False
frmSmallGenus.txtRemark.Enabled = False
frmSmallGenus.tlbOperate.Buttons("update").Enabled = False
frmSmallGenus.tlbOperate.Buttons("cancel").Enabled = False
If mrstDriveRoom.PageCount = 1 Then
frmSmallGenus.tlbOperate.Buttons("first").Enabled = False
frmSmallGenus.tlbOperate.Buttons("prev").Enabled = False
frmSmallGenus.tlbOperate.Buttons("next").Enabled = False
frmSmallGenus.tlbOperate.Buttons("last").Enabled = False
frmSmallGenus.tlbOperate.Buttons("cancel").Enabled = False
Else
End If
frmSmallGenus.Show 1
End Sub
Private Sub Form_Load()
mintCurPage = 1
mintPageSize = 1
Initfg
QuerySalesRoom
End Sub
Private Sub tlbOperate_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "add"
'添加
frmSmallGenus.P_SID = ""
frmSmallGenus.tlbOperate.Buttons("first").Enabled = False
frmSmallGenus.tlbOperate.Buttons("prev").Enabled = False
frmSmallGenus.tlbOperate.Buttons("next").Enabled = False
frmSmallGenus.tlbOperate.Buttons("last").Enabled = False
frmSmallGenus.Show 1
Case "edit"
frmSmallGenus.P_SID = Me.fg.TextMatrix(fg.Row, 3)
frmSmallGenus.cboGoodsBigTypeID.ListIndex = getComIndex(frmSmallGenus.cboGoodsBigTypeID, fg.TextMatrix(fg.Row, 1))
frmSmallGenus.txtGoodsSmallTypeID.Text = fg.TextMatrix(fg.Row, 3)
frmSmallGenus.txtGoodsSmallTypeName.Text = fg.TextMatrix(fg.Row, 4)
frmSmallGenus.txtRemark.Text = fg.TextMatrix(fg.Row, 5)
frmSmallGenus.txtGoodsSmallTypeID.Enabled = False
frmSmallGenus.tlbOperate.Buttons("first").Enabled = False
frmSmallGenus.tlbOperate.Buttons("prev").Enabled = False
frmSmallGenus.tlbOperate.Buttons("next").Enabled = False
frmSmallGenus.tlbOperate.Buttons("last").Enabled = False
frmSmallGenus.Show 1
Case "del"
'删除
If fg.TextMatrix(fg.Row, 1) = "" Then
Exit Sub
End If
If MsgBox("确实要删除商品小类编号为" & fg.TextMatrix(fg.Row, 3) & "的数据吗?", vbYesNo, "询问") = vbYes Then
Del (fg.TextMatrix(fg.Row, 3))
End If
Case "search"
'搜索
QuerySalesRoom
Case "refresh"
'刷新
QuerySalesRoom
Case "first"
'首页
mintCurPage = 1
gFillFg fg, mrstDriveRoom, Me.tlbOperate.Buttons, mintCurPage, mintPageSize
ShowID
Case "prev"
'前页
If mintCurPage <= mrstDriveRoom.PageCount Then
mintCurPage = mintCurPage - 1
gFillFg fg, mrstDriveRoom, Me.tlbOperate.Buttons, mintCurPage, mintPageSize
ShowID
End If
Case "next"
'下页
If mintCurPage + 1 <= mrstDriveRoom.PageCount Then
mintCurPage = mintCurPage + 1
gFillFg fg, mrstDriveRoom, Me.tlbOperate.Buttons, mintCurPage, mintPageSize
ShowID
End If
Case "last"
'末页
mintCurPage = -1
gFillFg fg, mrstDriveRoom, Me.tlbOperate.Buttons, mintCurPage, mintPageSize
ShowID
Case "preview"
'预览
Case "printout"
'打印
Case "quit"
Unload Me
End Select
End Sub
Public Sub Del(id As String)
'删除数据
On Error GoTo ErrShow
Dim sql As String
Dim Ars As New ADODB.Recordset
SQLDB.BeginTrans
'查询是否以使用了品牌
sql = "Select GoodsSmallTypeID from Cargo Where GoodsSmallTypeID='" & id & "'"
Set Ars = SQLDB.Execute(sql)
If Not Ars.EOF Then
MsgBox id & "已被使用,不能删除", vbInformation, "提示"
SQLDB.RollbackTrans
Exit Sub
End If
sql = "Delete GoodsSmallGenus Where GoodsSmallTypeID='" & id & "'"
SQLDB.Execute sql
SQLDB.CommitTrans
Initfg
QuerySalesRoom
MsgBox "删除成功", vbInformation, "提示"
Exit Sub
ErrShow:
SQLDB.RollbackTrans
MsgBox "删除" & id & "区域出错" & Err.Description, vbInformation, "提示"
Exit Sub
End Sub
Public Sub QuerySalesRoom()
'查询所有门市信息
Dim sql As String
sql = "SELECT GoodsBigGenus.GoodsBigTypeID AS 大类编号," & _
"GoodsBigGenus.GoodsBigTypeName AS 大类名称," & _
"GoodsSmallGenus.GoodsSmallTypeID AS 小类编号," & _
"GoodsSmallGenus.GoodsSmallTypeName AS 小类名称," & _
"GoodsSmallGenus.Remark AS 备注 " & _
"FROM GoodsSmallGenus INNER JOIN GoodsBigGenus ON " & _
"GoodsSmallGenus.GoodsBigTypeID = GoodsBigGenus.GoodsBigTypeID order by GoodsSmallGenus.id desc"
Set mrstDriveRoom = SQLDB.Execute(sql)
gFillFg fg, mrstDriveRoom, Me.tlbOperate.Buttons, mintCurPage, mintPageSize
fg.TextMatrix(0, 0) = "序号"
ShowID
End Sub
Public Sub Initfg()
fg.Clear
fg.Rows = 2
fg.Cols = 6
fg.FormatString = "序号 |<大类编号 |<大类名称 |<小类编号 |<小类名称 |<备注 "
ShowID
End Sub
Public Sub ShowID()
Dim i As Integer
'计算网格有多少行
For i = 1 To fg.Rows - 1
fg.TextMatrix(i, 0) = i
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -