dbTalk Databases Forums  

combining address fields in to 1 address field

comp.database.ms-access comp.database.ms-access


Discuss combining address fields in to 1 address field in the comp.database.ms-access forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
H
 
Posts: n/a

Default combining address fields in to 1 address field - 11-26-2007 , 12:50 PM






Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in another
field called 'address' so that field reads conventionally (i.e each fields
is on a separate line - and for lines to be moved up if no data is in the
preceding field.)

I had thought of making an update query using IIf statements but I can't see
what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.




Reply With Quote
  #2  
Old   
Patyrick Fisher
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 01-08-2008 , 06:01 PM







There a couple of ways that you can use, one is to use the Can Shrink
and Can Grow options on the address fields so that they only grow when
there is some content, you need to minimise the height of each field
and minimise the vertical seperation.
The other is to concatenate the strings that have content something
like this: address$= "str1" & vbcrlf & "str2" & vbcrlf & Str3 etc, you
will to add to this string only if the field has content so you can
say:
if not isnull(Str1) then address$ = Address$ & Name$ & vbcrlf
if not isnull(Str2) then address$ = Address$ & Street$ & vbcrlf
and so on.
Hope this helps
Patrick



On Mon, 26 Nov 2007 17:50:15 -0000, "H" <hal (AT) oldwestern (DOT) co.uk> wrote:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in another
field called 'address' so that field reads conventionally (i.e each fields
is on a separate line - and for lines to be moved up if no data is in the
preceding field.)

I had thought of making an update query using IIf statements but I can't see
what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.




Reply With Quote
  #3  
Old   
Patyrick Fisher
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 01-08-2008 , 06:01 PM




There a couple of ways that you can use, one is to use the Can Shrink
and Can Grow options on the address fields so that they only grow when
there is some content, you need to minimise the height of each field
and minimise the vertical seperation.
The other is to concatenate the strings that have content something
like this: address$= "str1" & vbcrlf & "str2" & vbcrlf & Str3 etc, you
will to add to this string only if the field has content so you can
say:
if not isnull(Str1) then address$ = Address$ & Name$ & vbcrlf
if not isnull(Str2) then address$ = Address$ & Street$ & vbcrlf
and so on.
Hope this helps
Patrick



On Mon, 26 Nov 2007 17:50:15 -0000, "H" <hal (AT) oldwestern (DOT) co.uk> wrote:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in another
field called 'address' so that field reads conventionally (i.e each fields
is on a separate line - and for lines to be moved up if no data is in the
preceding field.)

I had thought of making an update query using IIf statements but I can't see
what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.




Reply With Quote
  #4  
Old   
Patyrick Fisher
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 01-08-2008 , 06:01 PM




There a couple of ways that you can use, one is to use the Can Shrink
and Can Grow options on the address fields so that they only grow when
there is some content, you need to minimise the height of each field
and minimise the vertical seperation.
The other is to concatenate the strings that have content something
like this: address$= "str1" & vbcrlf & "str2" & vbcrlf & Str3 etc, you
will to add to this string only if the field has content so you can
say:
if not isnull(Str1) then address$ = Address$ & Name$ & vbcrlf
if not isnull(Str2) then address$ = Address$ & Street$ & vbcrlf
and so on.
Hope this helps
Patrick



On Mon, 26 Nov 2007 17:50:15 -0000, "H" <hal (AT) oldwestern (DOT) co.uk> wrote:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in another
field called 'address' so that field reads conventionally (i.e each fields
is on a separate line - and for lines to be moved up if no data is in the
preceding field.)

I had thought of making an update query using IIf statements but I can't see
what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.




Reply With Quote
  #5  
Old   
Patyrick Fisher
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 01-08-2008 , 06:01 PM




There a couple of ways that you can use, one is to use the Can Shrink
and Can Grow options on the address fields so that they only grow when
there is some content, you need to minimise the height of each field
and minimise the vertical seperation.
The other is to concatenate the strings that have content something
like this: address$= "str1" & vbcrlf & "str2" & vbcrlf & Str3 etc, you
will to add to this string only if the field has content so you can
say:
if not isnull(Str1) then address$ = Address$ & Name$ & vbcrlf
if not isnull(Str2) then address$ = Address$ & Street$ & vbcrlf
and so on.
Hope this helps
Patrick



On Mon, 26 Nov 2007 17:50:15 -0000, "H" <hal (AT) oldwestern (DOT) co.uk> wrote:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in another
field called 'address' so that field reads conventionally (i.e each fields
is on a separate line - and for lines to be moved up if no data is in the
preceding field.)

I had thought of making an update query using IIf statements but I can't see
what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.




Reply With Quote
  #6  
Old   
drangsalino
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 03-08-2008 , 10:53 AM



Hi,

use "vbcrlf" as line separator.

len([street])
will return NULL if [street] is NULL

however

len("" & [street]) will always return a valid string which can be used
in a statement like

address = lastname _
& iif(len("" & [firstname],", " & [firstname],"") _
& iif(len("" & [street],vbcrlf & [street],"") _
& iif(len("" & [village],vbcrlf & [village],"")

and then use the address variable in your update-query


HTH



"H" <hal (AT) oldwestern (DOT) co.uk> wrote in
news:GvudnYS4LNE0mtbaRVnyhwA (AT) eclipse (DOT) net.uk:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in
another field called 'address' so that field reads conventionally (i.e
each fields is on a separate line - and for lines to be moved up if no
data is in the preceding field.)

I had thought of making an update query using IIf statements but I
can't see what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.





Reply With Quote
  #7  
Old   
drangsalino
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 03-08-2008 , 10:53 AM



Hi,

use "vbcrlf" as line separator.

len([street])
will return NULL if [street] is NULL

however

len("" & [street]) will always return a valid string which can be used
in a statement like

address = lastname _
& iif(len("" & [firstname],", " & [firstname],"") _
& iif(len("" & [street],vbcrlf & [street],"") _
& iif(len("" & [village],vbcrlf & [village],"")

and then use the address variable in your update-query


HTH



"H" <hal (AT) oldwestern (DOT) co.uk> wrote in
news:GvudnYS4LNE0mtbaRVnyhwA (AT) eclipse (DOT) net.uk:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in
another field called 'address' so that field reads conventionally (i.e
each fields is on a separate line - and for lines to be moved up if no
data is in the preceding field.)

I had thought of making an update query using IIf statements but I
can't see what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.





Reply With Quote
  #8  
Old   
drangsalino
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 03-08-2008 , 10:53 AM



Hi,

use "vbcrlf" as line separator.

len([street])
will return NULL if [street] is NULL

however

len("" & [street]) will always return a valid string which can be used
in a statement like

address = lastname _
& iif(len("" & [firstname],", " & [firstname],"") _
& iif(len("" & [street],vbcrlf & [street],"") _
& iif(len("" & [village],vbcrlf & [village],"")

and then use the address variable in your update-query


HTH



"H" <hal (AT) oldwestern (DOT) co.uk> wrote in
news:GvudnYS4LNE0mtbaRVnyhwA (AT) eclipse (DOT) net.uk:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in
another field called 'address' so that field reads conventionally (i.e
each fields is on a separate line - and for lines to be moved up if no
data is in the preceding field.)

I had thought of making an update query using IIf statements but I
can't see what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.





Reply With Quote
  #9  
Old   
drangsalino
 
Posts: n/a

Default Re: combining address fields in to 1 address field - 03-08-2008 , 10:53 AM



Hi,

use "vbcrlf" as line separator.

len([street])
will return NULL if [street] is NULL

however

len("" & [street]) will always return a valid string which can be used
in a statement like

address = lastname _
& iif(len("" & [firstname],", " & [firstname],"") _
& iif(len("" & [street],vbcrlf & [street],"") _
& iif(len("" & [village],vbcrlf & [village],"")

and then use the address variable in your update-query


HTH



"H" <hal (AT) oldwestern (DOT) co.uk> wrote in
news:GvudnYS4LNE0mtbaRVnyhwA (AT) eclipse (DOT) net.uk:

Quote:
Hi,

I have the following address fields in a table:
flat_number
house_name_or_number
street
village
postal_town
county
postcode
country

Since I can't make all fields mandatory, I'd like to create a way of
capturing only the data in fields that have data and putting that in
another field called 'address' so that field reads conventionally (i.e
each fields is on a separate line - and for lines to be moved up if no
data is in the preceding field.)

I had thought of making an update query using IIf statements but I
can't see what character to use for 'carriage return'.

Any help would be much appreciated.

Regards,

Hal.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.