Ascii character for vbcrlf

  • Thread starter Thread starter reidarT
  • Start date Start date
R

reidarT

How do I replace [enter] between lines in a memo field to another character?
(I know the replace command, I just want to know the ascii value for
enter in a memo -field)

reidarT
 
reidarT said:
How do I replace [enter] between lines in a memo field to another character?
(I know the replace command, I just want to know the ascii value for
enter in a memo -field)


Depends on where the new line was inserted. Excel uses the
NewLine character, Chr(10) Some programs use the Carriage
Return character Chr(13). If it was done in Access, the
character sequence Chr(13) & Chr(10)
 
Thank you
My code is as follows
Dim Kilde As String
Kilde = Chr(13) & Chr(10)
Set db4 = DBEngine.Workspaces(0).Databases(0)
Set qd4 = db4.CreateQueryDef("", "UPDATE tblTest SET
tblTest.NotatFelt = Replace(NotatFelt),Kilde,'<br>')")
qd4.Execute

NotatFelt is the Memo-code.
I get an Update-error
reidarT

Marshall Barton said:
reidarT said:
How do I replace [enter] between lines in a memo field to another
character?
(I know the replace command, I just want to know the ascii value for
enter in a memo -field)


Depends on where the new line was inserted. Excel uses the
NewLine character, Chr(10) Some programs use the Carriage
Return character Chr(13). If it was done in Access, the
character sequence Chr(13) & Chr(10)
 
You have the arguments backwards and SQL is not aware of VBA
variables

Is there a reason why you are creating a QueryDef to do
that?
Set db4 = DBEngine.Workspaces(0).Databases(0)
db4.Execute "UPDATE tblTest " & _
"SET NotatFelt = Replace(NotatFelt), " & _
" '<br>', Chr(13) & Chr(10))"
--
Marsh
MVP [MS Access]

Thank you
My code is as follows
Dim Kilde As String
Kilde = Chr(13) & Chr(10)
Set db4 = DBEngine.Workspaces(0).Databases(0)
Set qd4 = db4.CreateQueryDef("", "UPDATE tblTest SET
tblTest.NotatFelt = Replace(NotatFelt),Kilde,'<br>')")
qd4.Execute

NotatFelt is the Memo-code.
I get an Update-error
reidarT

"Marshall Barton" skrev
reidarT said:
How do I replace [enter] between lines in a memo field to another
character?
(I know the replace command, I just want to know the ascii value for
enter in a memo -field)


Depends on where the new line was inserted. Excel uses the
NewLine character, Chr(10) Some programs use the Carriage
Return character Chr(13). If it was done in Access, the
character sequence Chr(13) & Chr(10)
 
Try:

Set qd4 = db4.CreateQueryDef("", _
"UPDATE tblTest SET NotatFelt = Replace(NotatFelt, " & Kilde & _
",'<br>')")

SQL is not aware of VBA variable so you need to resolve it for the SQL
String. Personally, I don't even bother with the intermediate variable
Kilde. Try:

Set qd4 = db4.CreateQueryDef("", _
"UPDATE tblTest SET NotatFelt = " & _
" Replace(NotatFelt, Chr(13) & Chr(10), '<br>')")
 
Back
Top