| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 561 人关注过本帖
标题:高手帮忙,感激不尽!
取消只看楼主 加入收藏
fourthofjuly
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-10-27
收藏
 问题点数:0 回复次数:0 
高手帮忙,感激不尽!

这是一个管理信息系统中控件grid的源代码,高手们百忙之中能不能帮着看看,给个注解越详细越好,小弟我真是看不明白,拜托了!
Dim t As Integer
Dim CZYname As String
Dim RS1 As ADODB.Recordset

Private Sub GridIni(OrdSql As String, t As Integer)

Set RS1 = New ADODB.Recordset

On Error GoTo errorhandle

grid.Clear
grid.Rows = 2
grid.FormatString = ">序号|<出库编号|<入库编号|<药品编号|<药品名称|<药品规格|出库数量|<价格|<出库日期|<出库发票号|>出库操作员工号|>出库操作日期"
grid.TextMatrix(1, 1) = "CKBH"
grid.TextMatrix(1, 2) = "RKBH"
grid.TextMatrix(1, 3) = "YPBH"
grid.TextMatrix(1, 4) = "YPMC"
grid.TextMatrix(1, 5) = "YPGG"
grid.TextMatrix(1, 6) = "CKSL"
grid.TextMatrix(1, 7) = "JG"
grid.TextMatrix(1, 8) = "CKRQ"
grid.TextMatrix(1, 9) = "CKFPHM"
grid.TextMatrix(1, 10) = "CKCZYGH"
grid.TextMatrix(1, 11) = "CKCZRQ"
grid.RowHeight(1) = 0
grid.ColWidth(1) = 0


SQL = "select * from CKMXZB AS Z INNER JOIN CKMXCB AS C ON Z.CKBH=C.CKBH where RFRQ IS NULL and YYJGBH='" & TemYYJGBH & "'"
If OrdSql <> "" Then
SQL = SQL & " order by " & OrdSql
If t = 1 Then
SQL = SQL & " asc"
Else
SQL = SQL & " desc"
End If
End If

RS.Open SQL, myConn

If Not RS.EOF Then
With RS
.MoveFirst
While Not .EOF
grid.Rows = grid.Rows + 1
grid.Row = grid.Rows - 1
grid.TextMatrix(grid.Row, 0) = grid.Row - 1

SQL = "select * from YPZD where YPBH='" & .Fields("YPBH") & "'"
RS1.Open SQL, myConn
If RS1.EOF Then
MsgBox "无药品编号为" & .Fields("YPBH") & "的药品信息,请检查药品字典", , "注意"
RS.Close
RS1.Close
End
Exit Sub
End If

For i = 1 To grid.Cols - 1

Select Case i
Case 4
grid.TextMatrix(grid.Row, i) = RS1.Fields("YPMC")
Case 5
grid.TextMatrix(grid.Row, i) = RS1.Fields("YPGG")
Case Else
grid.TextMatrix(grid.Row, i) = IIf(IsNull(.Fields(grid.TextMatrix(1, i))), "", .Fields(grid.TextMatrix(1, i)))
End Select


Next i
RS1.Close
.MoveNext
Wend
End With
End If
RS.Close
grid.Rows = grid.Rows + 1
grid.TextMatrix(grid.Rows - 1, 0) = grid.Rows - 2
Exit Sub

errorhandle:
myErrorHandle

End Sub

搜索更多相关主题的帖子: 感激不尽 
2005-11-10 12:32
快速回复:高手帮忙,感激不尽!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.089457 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved