Ascii character for vbcrlf

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
 
M

Marshall Barton

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)
 
R

reidarT

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)
 
M

Marshall Barton

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)
 
V

Van T. Dinh

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>')")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top