我具有生成文本的功能:表单上的Voornaam PlattenTuub。现在,我想更改布局:Voornaam雾为大胆,PlattenTuub必须为斜体。我该如何更改(请参见下文)。
Public Function fConcatPlat(intRit As Integer) As String
strBuild = ""
strSQL = "SELECT * FROM [tblPlattenTuub] WHERE [Rit] = " & intRit & " ORDER BY [Rit] ;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenForwardOnly)
With rs
Do While Not .EOF
If ![PlattenTuub] = 1 Then
strBuild = strBuild & " " & ![Voornaam] & " -"
Else
strBuild = strBuild & " " & ![Voornaam] & " " & ![PlattenTuub] & " -"
End If
.MoveNext
Loop
End With
strBuild = Left$(strBuild, Len(strBuild) - 1)
rs.Close
Set rs = Nothing
fConcatPlat = strBuild
End Function
我假设您要在文本框中显示结果。将其。TextFormat属性设置为“ Rich Text”。比将您的vba代码更改为:
strBuild = strBuild & " <b>" & ![Voornaam] & "</b>"
If ![PlattenTuub] = 1 Then
strBuild = strBuild & " <i>" & ![PlattenTuub] & "</i>"
End If
strBuild = strBuild & " -"