inserting newline into MS Access

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
discobean
Forum Commoner
Posts: 49
Joined: Sun May 18, 2003 9:06 pm
Location: Sydney, Australia
Contact:

inserting newline into MS Access

Post by discobean »

g'day,

I'm connecting to an access database thru odbc using php..

when inserting into a text(256) field, I can't seem to get a newline character up..

I have tried inserting a string such as this:

Code: Select all

$query = "
  INSERT INTO tablename (fieldname)
  VALUES ('line1\nline2\rline3\n\rline4\r\nline5');
";
and none of these newline combinations work...

I've also tried chr(13) to make sure.

Any ideas?

Marz.[/b]
Last edited by discobean on Tue Jun 03, 2003 9:45 am, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

how did you test that there are no linebreaks?
User avatar
discobean
Forum Commoner
Posts: 49
Joined: Sun May 18, 2003 9:06 pm
Location: Sydney, Australia
Contact:

Post by discobean »

all that showed up were sqare text characters in the application that uses the field..

I also opened up the table in access, and I got the same square characters.

I can enter returns in access using CTRL-Enter which works fine...

I ended up just comma delimiting instead of new lines, but if anybody has any ideas let me know.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

did you try \r\n ?
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

you may want to also try chr(10) + chr(13)
Weird0
Forum Newbie
Posts: 3
Joined: Fri May 30, 2003 2:34 pm

Post by Weird0 »

How about vbcrlf
User avatar
discobean
Forum Commoner
Posts: 49
Joined: Sun May 18, 2003 9:06 pm
Location: Sydney, Australia
Contact:

Post by discobean »

volka, \r\n was listed in my first example between line4 and line5, no dosn't work :(
hedge, chr(10).chr(13) no go either :(
and weird0 I have no idea what vbcrlf means :?

:(

access is the only db i've had problems with, and its the only one I've connected to and used UPDATE/INSERT via ODBC, has anybody had a similar problem with access or odbc?
Post Reply