Click to See Complete Forum and Search --> : formatting data sent to / retreived from database


marko_one
03-25-2003, 12:31 PM
Hi All,
I wonder if it is possible to be able to format data taken from a form as you want it.

I have a form which takes the address of an individual in the form of 5 textboxes named Address1, Address2,... Address5

I want to be able to store this complete value in an msaccess database so that a new line is given for each address value. So 5 address lines are given and put into 1 Address Field in the database. When I display the values back to a table I get the whole address, not formatted as lines 1 to 5. For example I have an address

123 This Street
Meadows Hall
This Area
This County
This Country

I Would like it to come out as above when retrieved from the database, but it comes out like this:

123 This Street Meadows Hall This Area This County
This Country

Can anybody help with formattiing

Thanks

Marko

ChrisBrown
03-25-2003, 05:10 PM
A longer method that you could do is to first insert something like "#break" in between the pieces of data in the string that gets inserted into the database.

Then when you call out the data, insert the string into a variable, like strAddress. Then do a replace for each #break and insert a "<br>" in the place of #break when you want to display the data. So it would something like:

strAddress = <string or DB value here>
strAddress = Replace(strAddress, "#break", "<br>")

It makes the data in your DB less pretty, but it's a method you could use to format it the way you want when you call it out.

marko_one
03-26-2003, 04:35 AM
Thanks for that, I figured it would possibly be something like this. I was hoping there would be a simpler workaround...

Marko