對spread的幾個操作
‘在兩個spread表格中復制一行fpdoutmemo->fpdoutmemo2
‘SrcRow源行號
‘DetRow目的行號
Private Sub CopiMemo(SrcRow As Long, DetRow As Long)
Dim i As Integer
With fpdOutmemo2
If DetRow > .MaxRows Then ‘如果需要復制的行超過目的的最大行
Exit Sub
End If
.Row = DetRow: fpdOutmemo.Row = SrcRow ‘定位行
For i = 1 To fpdOutmemo.MaxCols ‘復制一行中的每一列
.Col = i: fpdOutmemo.Col = i
.Text = fpdOutmemo.Text
Next i
End With
End Sub
‘在fpdOutmemo2表格中插入一行
‘SrcRow源行號
Private Sub InsertMemo(SrcRow As Long)
With fpdOutmemo2
.MaxRows = .MaxRows + 1 ‘增加一個行
Call CopiMemo(SrcRow, .MaxRows)
End With
End Sub
‘fpdOutmemo2,并不刪掉,只是把選擇去掉
Private Sub DelMemo2(DetRow As Long)
Dim i As Long
With fpdOutmemo2
.Col = 1‘選擇框
.Text = 0
End With
End Sub
‘fpdOutmemo2,刪除
Private Sub DelMemo3()
Dim i As Long
Dim j As Long
With fpdOutmemo2
j = 0
For i = i To .MaxRows
.Col = 1
.Row = i
If .Text = 0 Then
.DeleteRows i, 1‘刪除行
j = j + 1
End If
Next i
.MaxRows = .MaxRows - j‘更新最大行記錄數(shù),否則會出現(xiàn)空白行
End With
End Sub
‘查找表格中相同的記錄在fpdoutmemo中查找和fpdoutmemo2中相同的記錄
Private Function FindMemo2(SrcRow As Long) As Long
Dim strOutMemo As String
Dim strProductid As String
Dim strOutMemo2 As String
Dim strProductid2 As String
Dim i As Long
FindMemo2 = 0
With fpdOutmemo2
If SrcRow > .MaxRows Then
FindMemo2 = 0 ‘沒有找到
Exit Function
End If
.Row = SrcRow
.Col = INT_FPMEMO_KEY_OUTMEMOID ‘單證號
strOutMemo = .Text
.Col = INT_FPMEMO_KEY_PRODUCTID ‘成品號
strProductid = .Text
End With
With fpdOutmemo
If .MaxRows = 0 Then
FindMemo2 = 0 ‘沒有找到
Exit Function
End If
For i = 1 To .MaxRows
.Row = i
.Col = INT_FPMEMO_KEY_OUTMEMOID
strOutMemo2 = .Text
.Col = INT_FPMEMO_KEY_PRODUCTID
strProductid2 = .Text
‘只有在兩條記錄的單證號和成品號都相等的情況,才算找到
If strOutMemo = strOutMemo2 And strProductid = strProductid2 Then
FindMemo2 = i ‘返回找到的記錄的行
Exit Function
End If
Next i
End With
End Function
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。