我想保存一些特殊格式的数据。例如:
- AAAA
- BBBB
- 中国交建
- DDDD
我可以将这些信息保存在 Access 中,但是当我想将它们显示给用户时。它在文本框中显示如下: AAAABBBBCCCCCDDDD 没有任何换行符。我的问题是:如何在 MS Access DB 中保存换行符?
非常感谢您的帮助!
编辑 1
即我在 .txt 文件中有这个信息块:
KENNLINIE KLPRAIL 3
LANGNAME "Kennlinie zur Umsetzung Raildrucksensorspannung in Raildruck"
FUNKTION GGDSKV
EINHEIT_X "V"
EINHEIT_W "MPa"
ST/X 0.4980468750000000 1.8002319335937500 5.0000000000000000
WERT 0.0000000000000000 4.5000000000000000 15.5600000000000000
END
我想将KLPRAIL 3保存在一列中
EINHEIT_X "V"
EINHEIT_W "MPa"
ST/X 0.4980468750000000 1.8002319335937500 5.0000000000000000
WERT 0.0000000000000000 4.5000000000000000 15.5600000000000000
在另一列
我可以用这段代码来完成这项工作:
Dim kennL As String
Dim kennLS As Boolean
Dim kennLvalue As String
Dim kennLwert As String
Dim keLx As String
Dim keLw As String
Dim kelwer As String
kennL = InStr(1, entireline, "KENNLINIE")
keLx = InStr(1, entireline, "EINHEIT_X")
keLw = InStr(1, entireline, "EINHEIT_W")
keLsx = InStr(1, entireline, "ST/X")
kelwer = InStr(1, entireline, "WERT")
keLend = InStr(1, entireline, "END")
If kennL = 1 Then
kennLvalue = Mid(entireline, 10)
kennLS = True
End If
If keLx = 4 And kennLS = True Then
kennLwert = kennLwert + Mid(entireline, 4) + vbNewLine
End If
If keLw = 4 And kennLS = True Then
kennLwert = kennLwert + Mid(entireline, 4) + vbNewLine
End If
If kennLS = True And (keLsx = 4 Or kelwer = 4) Then
kennLwert = kennLwert + Mid(entireline, 4) + vbNewLine
End If
If kennLS = True And keLend = 1 Then
DoCmd.RunSQL ("INSERT INTO Test_dcml (WertName,WertValue) VALUES ('" & kennLvalue & "','" & kennLwert & "');")
kennLS = False
End If
但如果我向用户显示此信息。这些信息显示如下:
EINHEIT_X "V" EINHEIT_W "MPa" ST/X 0.4980468750000000 1.8002319335937500 5.0000000000000000 WERT 0.0000000000000000 4.5000000000000000 15.5600000000000000
编辑2
I use this code to show this Information to user:
Dim rcst As Recordset
Set rcst = CurrentDb.OpenRecordset("Test_Wertquery")
rcst.MoveFirst
Text5.SetFocus
Me.Text5.Text = rcst.Fields("WertValue").Value