主题:一个星期贴完自己写的药品进销存管理软件(八)
'文件名;FROM1.FRM
'用于基本资料的增删减工作
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Dim SHOWEDIT As Boolean
Private Sub AddCmd_Click()
On Error GoTo EndSub
If SSTab1.Tab = 3 Then
If TreeView1.SelectedItem.Text = "所有类别" Then Exit Sub
End If
SSTab1_Click SSTab1.Tab
AddData = True
SHOWEDIT = True
JbzlEdit.Show 1
EndSub:
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Command2_Click()
GlName = "药品类别"
JbzlEdit.LB.Caption = "添加"
SHOWEDIT = True
JbzlEdit.Show 1
GlName = "药品名称管理"
End Sub
Private Sub DelCmd_Click()
Dim SqlStr1 As String
If DelCmd.Enabled = False Then Exit Sub
If Grid1.Text = "" Then Exit Sub
Select Case SSTab1.Tab
Case 0
SqlStr1 = " delete from gys where id= " & Val(Grid1.Text)
Case 1
SqlStr1 = " delete from scfactory where id= " & Val(Grid1.Text)
Case 2
SqlStr1 = " delete from jx where id= " & Val(Grid1.Text)
Case 3
SqlStr1 = " delete from ypinfo where id= " & Val(Grid1.Text)
Case 4
SqlStr1 = " delete from dw where id= " & Val(Grid1.Text)
Case 5
SqlStr1 = " delete from khm where id= " & Val(Grid1.Text)
Case 6
SqlStr1 = " delete from yginfo where id= " & Val(Grid1.Text)
Case 7, 8
MsgBox "不能删除此类信息,此类信息在系统中能建立,不能修改或删除", vbCritical + vbOKOnly, "删除"
Exit Sub
End Select
'If MsgBox("您是否要删除?", vbYesNo + vbQuestion, "") = vbNo Then Exit Sub
If MsgBox("您是否要删除这个 " & Mid(SSTab1.TabCaption(SSTab1.Tab), 1, Len(SSTab1.TabCaption(SSTab1.Tab)) - 2) & " " & Grid1.TextMatrix(Grid1.Row, 3) & " 资料?", vbCritical + vbYesNo, "删除资料") = vbNo Then Exit Sub
'ViewObj.ListItems.Remove (ViewObj.SelectedItem.Index)
DataCon.Execute SqlStr1
If Grid1.Rows = 2 Then
For i = 1 To Grid1.Cols - 1
Grid1.TextMatrix(1, i) = ""
Next i
Else
Grid1.RemoveItem Grid1.Row
End If
End Sub
Private Sub DwView_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu 弹出
End Sub
Private Sub DwViewCmd_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from dw order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
DataRedSet.Close
Grid1.ColWidth(0) = 300
Grid1.TextMatrix(0, 1) = "序号"
Grid1.TextMatrix(0, 2) = "拼音代码"
Grid1.TextMatrix(0, 3) = "单位名称"
Grid1.ColWidth(1) = 600
Grid1.ColWidth(2) = 1200
Grid1.ColWidth(3) = (Grid1.Width - 900) - Grid1.ColWidth(2) - 300
End Sub
Private Sub EditCmd_Click()
SSTab1_Click SSTab1.Tab
JbzlEdit.IdLabel = Grid1.Text
Select Case SSTab1.Tab
Case 0, 5 '用户,供应商
JbzlEdit.GysTxt(0) = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.GysTxt(1) = Grid1.TextMatrix(Grid1.Row, 2)
For i = 4 To Grid1.Cols - 1
JbzlEdit.GysTxt(i - 2) = Grid1.TextMatrix(Grid1.Row, i)
Next i
JbzlEdit.Toolbar1.Buttons(1) = "更新"
Case 6 '员工资料
JbzlEdit.YgTxt(0) = Grid1.TextMatrix(Grid1.Row, 2)
JbzlEdit.Combo1 = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.YgTxt(1) = Grid1.TextMatrix(Grid1.Row, 4) '年
JbzlEdit.YgTxt(2) = Grid1.TextMatrix(Grid1.Row, 5) '年
JbzlEdit.YgTxt(3) = Grid1.TextMatrix(Grid1.Row, 6) '年
JbzlEdit.YgBar.Buttons(1) = "更新"
Case 1, 2, 4
JbzlEdit.Text1 = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.Text2 = Grid1.TextMatrix(Grid1.Row, 2)
JbzlEdit.SCQYBar.Buttons(1) = "更新"
Case 3
On Error Resume Next
DataRedSet.Close
DataRedSet.Open "select DISTINCT jx from ypinfo order by jx", SqlConStr
Do While Not DataRedSet.EOF
JbzlEdit.Combo2.AddItem Trim(DataRedSet.Fields(0))
DataRedSet.MoveNext
Loop
DataRedSet.Close
DataRedSet.Open "select DISTINCT dw from ypinfo order by dw", SqlConStr
Do While Not DataRedSet.EOF
JbzlEdit.Combo3.AddItem Trim(DataRedSet.Fields(0))
DataRedSet.MoveNext
Loop
DataRedSet.Close
JbzlEdit.YPINFO(0) = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.YPINFO(1) = Grid1.TextMatrix(Grid1.Row, 2)
JbzlEdit.YPINFO(2) = Grid1.TextMatrix(Grid1.Row, 4)
JbzlEdit.Combo2 = Grid1.TextMatrix(Grid1.Row, 5)
JbzlEdit.Combo3 = Grid1.TextMatrix(Grid1.Row, 6)
JbzlEdit.YPINFO(3) = Grid1.TextMatrix(Grid1.Row, 7)
JbzlEdit.YPINFO(4) = Grid1.TextMatrix(Grid1.Row, 8)
JbzlEdit.YPINFO(5) = Grid1.TextMatrix(Grid1.Row, 9)
JbzlEdit.YpBar.Buttons(1) = "更新"
Case 7, 8
MsgBox "不能删除此类信息,此类信息在系统中能建立,不能修改或删除", vbCritical + vbOKOnly, "删除"
Exit Sub
End Select
JbzlEdit.Show 1
End Sub
Private Sub Form_Activate()
If SHOWEDIT = True Then
Exit Sub
End If
Dim SHOWOK As Boolean
For i = 0 To 8
If SSTab1.TabVisible(i) = True Then
SSTab1.Tab = i
SSTab1.TabVisible(i) = True
SSTab1_Click SSTab1.Tab
Exit For
Else
SHOWOK = True
End If
Next i
If SHOWOK Then
资料.Enabled = False
资料.Visible = False
跳转到.Enabled = False
跳转到.Visible = False
End If
End Sub
Private Sub Form_Initialize()
InitCommonControls
End Sub
Private Sub Form_Load()
Text3.Enabled = False
SHOWEDIT = False
frmMain.SBar1.Panels(2).Text = ""
'GlName = "供应商管理"
End Sub
Private Sub Form_Resize()
SSTab1.Width = Me.ScaleWidth
SSTab1.Height = Me.Height - SSTab1.Top
If SSTab1.Tab <> 6 And SSTab1.Tab <> 3 Then
Grid1.Left = 90
Grid1.Width = SSTab1.Width - Grid1.Left - 90
ElseIf SSTab1.Tab = 6 Then
Grid1.Width = SSTab1.Width - Tree1.Width - 120
Grid1.Left = Tree1.Width + Tree1.Left
ElseIf SSTab1.Tab = 3 Then
Grid1.Width = SSTab1.Width - TreeView1.Width - 120
Grid1.Left = TreeView1.Width + TreeView1.Left
Command2.Top = SSTab1.Height - Command2.Height - SSTab1.Top + 200
Command3.Top = Command2.Top
TreeView1.Height = Command2.Top - 400
End If
Grid1.Height = Me.ScaleHeight - Grid1.Top - 30 ' SSTab1.Height - (SSTab1.Top - Grid1.Top)
Tree1.Height = Grid1.Height
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
DataRedSet.Close
End Sub
Private Sub ypmcView_DblClick()
EditCmd_Click
End Sub
Private Sub dwView_DblClick()
EditCmd_Click
End Sub
Private Sub Grid1_DblClick()
EditCmd_Click
End Sub
Private Sub Grid1_GotFocus()
' Oldwinproc = GetWindowLong(Me.hWnd, GWL_WNDPROC)
' SetWindowLong Me.hWnd, GWL_WNDPROC, AddressOf FlexScroll
End Sub
Private Sub Grid1_LostFocus()
'SetWindowLong Me.hWnd, GWL_WNDPROC, Oldwinproc
End Sub
Private Sub Grid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu 弹出
End Sub
Private Sub GysViewCmd_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from gys order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
DataRedSet.Close
Grid1.ColWidth(0) = 300
Grid1.TextMatrix(0, 1) = "序号"
Grid1.TextMatrix(0, 2) = "拼音代码"
Grid1.TextMatrix(0, 3) = "供应商名称"
Grid1.TextMatrix(0, 4) = "联系人"
Grid1.TextMatrix(0, 5) = "联系电话"
Grid1.TextMatrix(0, 6) = "开户行"
Grid1.TextMatrix(0, 7) = "银行帐号"
Grid1.TextMatrix(0, 8) = "应收金额"
Grid1.TextMatrix(0, 9) = "应付金额"
Grid1.ColWidth(1) = 600
Grid1.ColWidth(2) = 1500
Grid1.ColWidth(3) = 2300
Grid1.ColWidth(7) = 2300
Dim i As Integer
For i = 1 To Grid1.Rows - 1
Grid1.TextMatrix(i, 8) = Format(Val(Grid1.TextMatrix(i, 8)), "¥" & "###,###,###.0#")
Grid1.TextMatrix(i, 9) = Format(Val(Grid1.TextMatrix(i, 9)), "¥" & "###,###,###.0#")
Next i
GetGridWith Grid1, SSTab1.Caption, 0
End Sub
Private Sub JXViewCmd_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from jx order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
DataRedSet.Close
Grid1.ColWidth(0) = 300
Grid1.TextMatrix(0, 1) = "序号"
Grid1.TextMatrix(0, 2) = "拼音代码"
Grid1.TextMatrix(0, 3) = "剂型名称"
Grid1.ColWidth(1) = 600
Grid1.ColWidth(2) = 1200
Grid1.ColWidth(3) = (Grid1.Width - 900) - Grid1.ColWidth(2) - 300
End Sub
Private Sub KhmView_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from khm order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
'用于基本资料的增删减工作
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Dim SHOWEDIT As Boolean
Private Sub AddCmd_Click()
On Error GoTo EndSub
If SSTab1.Tab = 3 Then
If TreeView1.SelectedItem.Text = "所有类别" Then Exit Sub
End If
SSTab1_Click SSTab1.Tab
AddData = True
SHOWEDIT = True
JbzlEdit.Show 1
EndSub:
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Command2_Click()
GlName = "药品类别"
JbzlEdit.LB.Caption = "添加"
SHOWEDIT = True
JbzlEdit.Show 1
GlName = "药品名称管理"
End Sub
Private Sub DelCmd_Click()
Dim SqlStr1 As String
If DelCmd.Enabled = False Then Exit Sub
If Grid1.Text = "" Then Exit Sub
Select Case SSTab1.Tab
Case 0
SqlStr1 = " delete from gys where id= " & Val(Grid1.Text)
Case 1
SqlStr1 = " delete from scfactory where id= " & Val(Grid1.Text)
Case 2
SqlStr1 = " delete from jx where id= " & Val(Grid1.Text)
Case 3
SqlStr1 = " delete from ypinfo where id= " & Val(Grid1.Text)
Case 4
SqlStr1 = " delete from dw where id= " & Val(Grid1.Text)
Case 5
SqlStr1 = " delete from khm where id= " & Val(Grid1.Text)
Case 6
SqlStr1 = " delete from yginfo where id= " & Val(Grid1.Text)
Case 7, 8
MsgBox "不能删除此类信息,此类信息在系统中能建立,不能修改或删除", vbCritical + vbOKOnly, "删除"
Exit Sub
End Select
'If MsgBox("您是否要删除?", vbYesNo + vbQuestion, "") = vbNo Then Exit Sub
If MsgBox("您是否要删除这个 " & Mid(SSTab1.TabCaption(SSTab1.Tab), 1, Len(SSTab1.TabCaption(SSTab1.Tab)) - 2) & " " & Grid1.TextMatrix(Grid1.Row, 3) & " 资料?", vbCritical + vbYesNo, "删除资料") = vbNo Then Exit Sub
'ViewObj.ListItems.Remove (ViewObj.SelectedItem.Index)
DataCon.Execute SqlStr1
If Grid1.Rows = 2 Then
For i = 1 To Grid1.Cols - 1
Grid1.TextMatrix(1, i) = ""
Next i
Else
Grid1.RemoveItem Grid1.Row
End If
End Sub
Private Sub DwView_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu 弹出
End Sub
Private Sub DwViewCmd_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from dw order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
DataRedSet.Close
Grid1.ColWidth(0) = 300
Grid1.TextMatrix(0, 1) = "序号"
Grid1.TextMatrix(0, 2) = "拼音代码"
Grid1.TextMatrix(0, 3) = "单位名称"
Grid1.ColWidth(1) = 600
Grid1.ColWidth(2) = 1200
Grid1.ColWidth(3) = (Grid1.Width - 900) - Grid1.ColWidth(2) - 300
End Sub
Private Sub EditCmd_Click()
SSTab1_Click SSTab1.Tab
JbzlEdit.IdLabel = Grid1.Text
Select Case SSTab1.Tab
Case 0, 5 '用户,供应商
JbzlEdit.GysTxt(0) = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.GysTxt(1) = Grid1.TextMatrix(Grid1.Row, 2)
For i = 4 To Grid1.Cols - 1
JbzlEdit.GysTxt(i - 2) = Grid1.TextMatrix(Grid1.Row, i)
Next i
JbzlEdit.Toolbar1.Buttons(1) = "更新"
Case 6 '员工资料
JbzlEdit.YgTxt(0) = Grid1.TextMatrix(Grid1.Row, 2)
JbzlEdit.Combo1 = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.YgTxt(1) = Grid1.TextMatrix(Grid1.Row, 4) '年
JbzlEdit.YgTxt(2) = Grid1.TextMatrix(Grid1.Row, 5) '年
JbzlEdit.YgTxt(3) = Grid1.TextMatrix(Grid1.Row, 6) '年
JbzlEdit.YgBar.Buttons(1) = "更新"
Case 1, 2, 4
JbzlEdit.Text1 = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.Text2 = Grid1.TextMatrix(Grid1.Row, 2)
JbzlEdit.SCQYBar.Buttons(1) = "更新"
Case 3
On Error Resume Next
DataRedSet.Close
DataRedSet.Open "select DISTINCT jx from ypinfo order by jx", SqlConStr
Do While Not DataRedSet.EOF
JbzlEdit.Combo2.AddItem Trim(DataRedSet.Fields(0))
DataRedSet.MoveNext
Loop
DataRedSet.Close
DataRedSet.Open "select DISTINCT dw from ypinfo order by dw", SqlConStr
Do While Not DataRedSet.EOF
JbzlEdit.Combo3.AddItem Trim(DataRedSet.Fields(0))
DataRedSet.MoveNext
Loop
DataRedSet.Close
JbzlEdit.YPINFO(0) = Grid1.TextMatrix(Grid1.Row, 3)
JbzlEdit.YPINFO(1) = Grid1.TextMatrix(Grid1.Row, 2)
JbzlEdit.YPINFO(2) = Grid1.TextMatrix(Grid1.Row, 4)
JbzlEdit.Combo2 = Grid1.TextMatrix(Grid1.Row, 5)
JbzlEdit.Combo3 = Grid1.TextMatrix(Grid1.Row, 6)
JbzlEdit.YPINFO(3) = Grid1.TextMatrix(Grid1.Row, 7)
JbzlEdit.YPINFO(4) = Grid1.TextMatrix(Grid1.Row, 8)
JbzlEdit.YPINFO(5) = Grid1.TextMatrix(Grid1.Row, 9)
JbzlEdit.YpBar.Buttons(1) = "更新"
Case 7, 8
MsgBox "不能删除此类信息,此类信息在系统中能建立,不能修改或删除", vbCritical + vbOKOnly, "删除"
Exit Sub
End Select
JbzlEdit.Show 1
End Sub
Private Sub Form_Activate()
If SHOWEDIT = True Then
Exit Sub
End If
Dim SHOWOK As Boolean
For i = 0 To 8
If SSTab1.TabVisible(i) = True Then
SSTab1.Tab = i
SSTab1.TabVisible(i) = True
SSTab1_Click SSTab1.Tab
Exit For
Else
SHOWOK = True
End If
Next i
If SHOWOK Then
资料.Enabled = False
资料.Visible = False
跳转到.Enabled = False
跳转到.Visible = False
End If
End Sub
Private Sub Form_Initialize()
InitCommonControls
End Sub
Private Sub Form_Load()
Text3.Enabled = False
SHOWEDIT = False
frmMain.SBar1.Panels(2).Text = ""
'GlName = "供应商管理"
End Sub
Private Sub Form_Resize()
SSTab1.Width = Me.ScaleWidth
SSTab1.Height = Me.Height - SSTab1.Top
If SSTab1.Tab <> 6 And SSTab1.Tab <> 3 Then
Grid1.Left = 90
Grid1.Width = SSTab1.Width - Grid1.Left - 90
ElseIf SSTab1.Tab = 6 Then
Grid1.Width = SSTab1.Width - Tree1.Width - 120
Grid1.Left = Tree1.Width + Tree1.Left
ElseIf SSTab1.Tab = 3 Then
Grid1.Width = SSTab1.Width - TreeView1.Width - 120
Grid1.Left = TreeView1.Width + TreeView1.Left
Command2.Top = SSTab1.Height - Command2.Height - SSTab1.Top + 200
Command3.Top = Command2.Top
TreeView1.Height = Command2.Top - 400
End If
Grid1.Height = Me.ScaleHeight - Grid1.Top - 30 ' SSTab1.Height - (SSTab1.Top - Grid1.Top)
Tree1.Height = Grid1.Height
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
DataRedSet.Close
End Sub
Private Sub ypmcView_DblClick()
EditCmd_Click
End Sub
Private Sub dwView_DblClick()
EditCmd_Click
End Sub
Private Sub Grid1_DblClick()
EditCmd_Click
End Sub
Private Sub Grid1_GotFocus()
' Oldwinproc = GetWindowLong(Me.hWnd, GWL_WNDPROC)
' SetWindowLong Me.hWnd, GWL_WNDPROC, AddressOf FlexScroll
End Sub
Private Sub Grid1_LostFocus()
'SetWindowLong Me.hWnd, GWL_WNDPROC, Oldwinproc
End Sub
Private Sub Grid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu 弹出
End Sub
Private Sub GysViewCmd_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from gys order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
DataRedSet.Close
Grid1.ColWidth(0) = 300
Grid1.TextMatrix(0, 1) = "序号"
Grid1.TextMatrix(0, 2) = "拼音代码"
Grid1.TextMatrix(0, 3) = "供应商名称"
Grid1.TextMatrix(0, 4) = "联系人"
Grid1.TextMatrix(0, 5) = "联系电话"
Grid1.TextMatrix(0, 6) = "开户行"
Grid1.TextMatrix(0, 7) = "银行帐号"
Grid1.TextMatrix(0, 8) = "应收金额"
Grid1.TextMatrix(0, 9) = "应付金额"
Grid1.ColWidth(1) = 600
Grid1.ColWidth(2) = 1500
Grid1.ColWidth(3) = 2300
Grid1.ColWidth(7) = 2300
Dim i As Integer
For i = 1 To Grid1.Rows - 1
Grid1.TextMatrix(i, 8) = Format(Val(Grid1.TextMatrix(i, 8)), "¥" & "###,###,###.0#")
Grid1.TextMatrix(i, 9) = Format(Val(Grid1.TextMatrix(i, 9)), "¥" & "###,###,###.0#")
Next i
GetGridWith Grid1, SSTab1.Caption, 0
End Sub
Private Sub JXViewCmd_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from jx order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If
DataRedSet.Close
Grid1.ColWidth(0) = 300
Grid1.TextMatrix(0, 1) = "序号"
Grid1.TextMatrix(0, 2) = "拼音代码"
Grid1.TextMatrix(0, 3) = "剂型名称"
Grid1.ColWidth(1) = 600
Grid1.ColWidth(2) = 1200
Grid1.ColWidth(3) = (Grid1.Width - 900) - Grid1.ColWidth(2) - 300
End Sub
Private Sub KhmView_Click()
On Error GoTo E1
DataRedSet.Close
DataRedSet.CursorLocation = adUseClient
E1:
DataRedSet.Open "select * from khm order by id", DataCon, 1, 3
Set Grid1.DataSource = DataRedSet
Set Grid1.DataSource = Nothing
If DataRedSet.RecordCount = 0 Then
Grid1.Rows = 200
Grid1.TopRow = 150
Grid1.Rows = 2
End If