macdonnie
01-20-2016, 10:35 AM
I have a Multiline textbox inside an Excel Userform. I enter in multiple lines of text:
15227
And then update the Access database. I no longer see text in access with multiplelines:
15228
I'm using the following code to update the database:
cmdCommand.ActiveConnection = conn
strSQLCommand = "UPDATE testTable SET testTable.stuffField = """ + comment + """ WHERE (((testTable.numberField)=""" + numberField + """) AND ((testTable.Book)=""" + book + """));"
cmdCommand.CommandText = strSQLCommand
cmdCommand.CommandType = 1
Set recSet = cmdCommand.Execute
conn.Close
Set conn = Nothing
When I look at the text from the Access Database I don't see carriage returns CR or LF(I copied the text into Notepad++). However, when I retrieve data from the access database and view it back in excel I do see that the text is multilined... (If I edit the text directly in access I can add multiple lines and do see the carriage returns)
The evidence leads me to believe that excel doesn't use standard carriage returns to display text in a textbox.
I have two questions:
1) Do you know if there is a difference in how Access stores newlines vs an Excel Textbox?
2) Do you see a way to adjust my code to send carriage returns to the Access Database? - BTW: I have tried adding Chr(10), Chr(13), and vbNewLine to the comment string and it didn't work.
Thanks,
-Don
15227
And then update the Access database. I no longer see text in access with multiplelines:
15228
I'm using the following code to update the database:
cmdCommand.ActiveConnection = conn
strSQLCommand = "UPDATE testTable SET testTable.stuffField = """ + comment + """ WHERE (((testTable.numberField)=""" + numberField + """) AND ((testTable.Book)=""" + book + """));"
cmdCommand.CommandText = strSQLCommand
cmdCommand.CommandType = 1
Set recSet = cmdCommand.Execute
conn.Close
Set conn = Nothing
When I look at the text from the Access Database I don't see carriage returns CR or LF(I copied the text into Notepad++). However, when I retrieve data from the access database and view it back in excel I do see that the text is multilined... (If I edit the text directly in access I can add multiple lines and do see the carriage returns)
The evidence leads me to believe that excel doesn't use standard carriage returns to display text in a textbox.
I have two questions:
1) Do you know if there is a difference in how Access stores newlines vs an Excel Textbox?
2) Do you see a way to adjust my code to send carriage returns to the Access Database? - BTW: I have tried adding Chr(10), Chr(13), and vbNewLine to the comment string and it didn't work.
Thanks,
-Don