求详细解释vb语句

来源:百度知道 编辑:UC知道 时间:2024/06/30 04:57:26
求一句句的详细解释,共有几段,辛苦了!符合要求的再加分!
第一段是关于查询的:
Private Sub XPButton6_Click()
On Error GoTo finish
If Grid2.Cell(1, 1).Text <> "" And Grid2.Cell(1, 2).Text <> "" And Grid2.Cell(1, 3).Text <> "" And Grid2.Cell(1, 4).Text <> "" Then
If Grid2.Cell(1, 1).Text = "精确查询" Then
Select Case Grid2.Cell(1, 3).Text
Case "数量", "单价", "进货价格", "售出价格", "总价格"
yxsql = "select * from 入库单 where " & Grid2.Cell(1, 2).Text & Grid2.Cell(1, 3).Text & Grid2.Cell(1, 4).Text
Case Else
yxsql = "select * from 入库单 where " & Grid2.Cell(1, 2).Text & Grid2.Cell(1, 3).Text & "'" & Grid2.Cell(1, 4).Text & "'"
End Select
Else
yxsql = "select * from 入库单 where " & Grid2.Cell(1, 2).Text & " like '%" & Grid2.Cell(1, 4).Text & "

’XPButton6的单击
Private Sub XPButton6_Click()
On Error GoTo finish ’错误处理 出错就转到finish
'(第一层条件)如果Grid2.Cell(1, 1) .Cell(1, 2) .Cell(1, 3) .Cell(1, 4)的文本不是空,就
If Grid2.Cell(1, 1).Text <> "" And Grid2.Cell(1, 2).Text <> "" And Grid2.Cell(1, 3).Text <> "" And Grid2.Cell(1, 4).Text <> "" Then
’(第二层条件)如果...等于"精确查询"就
If Grid2.Cell(1, 1).Text = "精确查询" Then
’(第三层条件)select的意思是:如果Grid2.Cell(1, 3).Text是case后边的条件时就处理case后边的代码
Select Case Grid2.Cell(1, 3).Text
Case "数量", "单价", "进货价格", "售出价格", "总价格"
’数据入库
yxsql = "select * from 入库单 where " & Grid2.Cell(1, 2).Text & Grid2.Cell(1, 3).Text & Grid2.Cell(1, 4).Text
Case Else
yxsql = "select * from 入库单 where " & Grid2.Cell(1, 2).Text & Grid2.Cell(1, 3).Text & "'" & Grid2.Cell(1,