Ms access 删除access中RTF长文本字段中多条记录的第一行
是否可以在access中删除富格文本长文本字段中多条记录的前几行?谢谢。显然,您可以,因为您可以在Access中执行许多字符串操作。 下次尝试展示一些研究和尝试 可以使用以下函数从字符串中删除行:Ms access 删除access中RTF长文本字段中多条记录的第一行,ms-access,vba,Ms Access,Vba,是否可以在access中删除富格文本长文本字段中多条记录的前几行?谢谢。显然,您可以,因为您可以在Access中执行许多字符串操作。 下次尝试展示一些研究和尝试 可以使用以下函数从字符串中删除行: Public Function RemoveLines(str As String, LineCount As Integer) As String Dim searchPosition As Integer searchPosition = 1 Dim linesPassed
Public Function RemoveLines(str As String, LineCount As Integer) As String
Dim searchPosition As Integer
searchPosition = 1
Dim linesPassed As Integer
linesPassed = 0
Dim Found As Integer
Found = 1
Do While linesPassed < LineCount
Found = InStr(searchPosition, str, vbCrLf)
If Found <> 0 Then
searchPosition = Found + 2
Else
RemoveLines = ""
Exit Function
End If
linesPassed = linesPassed + 1
Loop
RemoveLines = Mid(str, searchPosition)
End Function
将公共函数RemoveLines(str作为字符串,LineCount作为整数)作为字符串
将搜索位置设置为整数
搜索位置=1
Dim linesPassed为整数
linesPassed=0
Dim被发现为整数
发现=1
当linesPassed
这将从字符串中删除
LineCount
行。您可以在VBA或操作查询中使用它,尽管操作查询中的富格文本备注字段往往以一个换行符开头,并且所有换行符都会重复。如果您只需输入两倍于实际要删除的金额,它将在行动查询中起作用。太好了。非常感谢。