By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,406 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Form - compacting empty lines vertically.

P: n/a
Hi:

I have a form which contains the following entry ( one element on each line)

Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for apartment numbers
and things). The way the form works now, the name is followed by address line one
(completed with data) and then a blank line followed by the city state and zip. It looks
scattered and untidy.

Is there any way to vertically compress this so that when a line is blank it does not
appear or use a line on the form? This would make the form look a great deal tidier.

Thanks

John Baker

Nov 12 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
This is easily accomplished in a report, but not so easily in a form.
Think of the form as the way to put the information in -
you always want those blank lines to be available, in case someone has
some more information to add.
Think of a report as how you get the information out:
that's where you do the tidy formatting.

HTH
- Turtle

"John Baker" <Ba******@Verizon.net> wrote in message
news:ga********************************@4ax.com...
Hi:

I have a form which contains the following entry ( one element on each line)
Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for apartment numbers and things). The way the form works now, the name is followed by address line one (completed with data) and then a blank line followed by the city state and zip. It looks scattered and untidy.

Is there any way to vertically compress this so that when a line is blank it does not appear or use a line on the form? This would make the form look a great deal tidier.
Thanks

John Baker

Nov 12 '05 #2

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I usually have only one Address field that is 255 characters long and
the TextBox "Action on Enter" is "New Line." This will allow the user
to enter a multi-line address in the same field.

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8ZCmIechKqOuFEgEQLNdgCg3xRmMx90JDmeHOvx7iEuvg B0pr4AoN6w
hH8JW6cl0kq5tQUl2pfQcgMO
=PmLt
-----END PGP SIGNATURE-----

John Baker wrote:
Hi:

I have a form which contains the following entry ( one element on each line)

Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for apartment numbers
and things). The way the form works now, the name is followed by address line one
(completed with data) and then a blank line followed by the city state and zip. It looks
scattered and untidy.

Is there any way to vertically compress this so that when a line is blank it does not
appear or use a line on the form? This would make the form look a great deal tidier.

Thanks

John Baker

Nov 12 '05 #3

P: n/a
MGF:

Thanks for the idea, but how do you set up the macro, or code, to create a new line?
I set up:

Private Sub address_Enter()
New Line

End Sub

and it would not accept it!
Regards

John Baker

MGFoster <me@privacy.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I usually have only one Address field that is 255 characters long and
the TextBox "Action on Enter" is "New Line." This will allow the user
to enter a multi-line address in the same field.

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8ZCmIechKqOuFEgEQLNdgCg3xRmMx90JDmeHOvx7iEuvg B0pr4AoN6w
hH8JW6cl0kq5tQUl2pfQcgMO
=PmLt
-----END PGP SIGNATURE-----

John Baker wrote:
Hi:

I have a form which contains the following entry ( one element on each line)

Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for apartment numbers
and things). The way the form works now, the name is followed by address line one
(completed with data) and then a blank line followed by the city state and zip. It looks
scattered and untidy.

Is there any way to vertically compress this so that when a line is blank it does not
appear or use a line on the form? This would make the form look a great deal tidier.

Thanks

John Baker


Nov 12 '05 #4

P: n/a


I should add that when I set up new line in the Expression Builder, it accepts it but when
hit enter on the field, the form jumps to the next record! Not the behavior I want.

To be honest I don't know how to stop it from doing that either.

Regards

John Baker
John Baker <Ba******@Verizon.net> wrote:
MGF:

Thanks for the idea, but how do you set up the macro, or code, to create a new line?
I set up:

Private Sub address_Enter()
New Line

End Sub

and it would not accept it!
Regards

John Baker

MGFoster <me@privacy.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I usually have only one Address field that is 255 characters long and
the TextBox "Action on Enter" is "New Line." This will allow the user
to enter a multi-line address in the same field.

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8ZCmIechKqOuFEgEQLNdgCg3xRmMx90JDmeHOvx7iEuvg B0pr4AoN6w
hH8JW6cl0kq5tQUl2pfQcgMO
=PmLt
-----END PGP SIGNATURE-----

John Baker wrote:
Hi:

I have a form which contains the following entry ( one element on each line)

Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for apartment numbers
and things). The way the form works now, the name is followed by address line one
(completed with data) and then a blank line followed by the city state and zip. It looks
scattered and untidy.

Is there any way to vertically compress this so that when a line is blank it does not
appear or use a line on the form? This would make the form look a great deal tidier.

Thanks

John Baker


Nov 12 '05 #5

P: n/a
Hi Again:

If the solution to this is more complex that it appears, I could always do a query on the
fields and set upi one field with active address lines separated by a carriage return. I
know that is chr(13) in Excel, but its doesn't appear to be in Access. Can someone tell me
the chr code for a carrage return (enter)? With that I could construct something that
would do what I need.

Regards

John Baker
Nov 12 '05 #6

P: n/a
How would I do that in a report?

"MacDermott" <ma********@nospam.com> wrote:
This is easily accomplished in a report, but not so easily in a form.
Think of the form as the way to put the information in -
you always want those blank lines to be available, in case someone has
some more information to add.
Think of a report as how you get the information out:
that's where you do the tidy formatting.

HTH
- Turtle

"John Baker" <Ba******@Verizon.net> wrote in message
news:ga********************************@4ax.com.. .
Hi:

I have a form which contains the following entry ( one element on each

line)

Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for

apartment numbers
and things). The way the form works now, the name is followed by address

line one
(completed with data) and then a blank line followed by the city state and

zip. It looks
scattered and untidy.

Is there any way to vertically compress this so that when a line is blank

it does not
appear or use a line on the form? This would make the form look a great

deal tidier.

Thanks

John Baker


Nov 12 '05 #7

P: n/a
Hi:

I am sorry to waste so much of every ones time on this. I found the way to deal with
compaction in Reports, using the "Can Shrink" property. Simple, but only if you know if
it!

Regards

John Baker
Nov 12 '05 #8

P: n/a
---"It looks scattered and untidy.

Is there any way to vertically compress this so that when a line is
blank it does not appear or use a line on the form? This would make
the form look a great deal tidier."

As McDermott mentioned this is needed in the form

---"How would I do that in a report?"
(This is from access help)
In the ControlSource property box, type an expression that
concatenates the values from the appropriate fields.
For example, to return an address like

507 20th Ave. E., Seattle WA 98122

type this expression:

=[Address] & ", " & [City] & " " & [Region] & " " & [PostalCode]

Tip In a form or report in a Microsoft Access database (.mdb), you
can also click the Build button to use the Expression Builder to
create the expression.

--" but how do you set up the macro, or code, to create a new line?"

This is on the prperties window of the text box. In the 'Other' tab
there is an item 'Enter Key Behaviour' where you should choose 'New
Line'

--"I know that is chr(13) in Excel, but its doesn't appear to be in
Access."

Carriage return is chr(13) everywhere. But carriage return takes the
cursor only to the beginning of the line. You need a new line before
it : chr(10)& Chr(13)

HTH

Sunil Korah

John Baker <Ba******@Verizon.net> wrote in message news:<ns********************************@4ax.com>. ..
Hi Again:

If the solution to this is more complex that it appears, I could always do a query on the
fields and set upi one field with active address lines separated by a carriage return. I
know that is chr(13) in Excel, but its doesn't appear to be in Access. Can someone tell me
the chr code for a carrage return (enter)? With that I could construct something that
would do what I need.

Regards

John Baker

Nov 12 '05 #9

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What I meant was the Address Text Box property "Enter Key Behavior."

Open the form in design view.
Open the properties dialog box for the Address TextBox.
Click the Other tab.
Set the property "Enter Key Behavior" to "New Line in Field."

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8cPSYechKqOuFEgEQLo9ACfXsj3WY1HTM+8/YWhI/m2WkZfqLgAoNQ8
XGcmEvdctehH34WbPz8cs7gx
=Fp2+
-----END PGP SIGNATURE-----

John Baker wrote:
MGF:

Thanks for the idea, but how do you set up the macro, or code, to create a new line?
I set up:

Private Sub address_Enter()
New Line

End Sub

and it would not accept it!
Regards

John Baker

MGFoster <me@privacy.com> wrote:


I usually have only one Address field that is 255 characters long and
the TextBox "Action on Enter" is "New Line." This will allow the user
to enter a multi-line address in the same field.

< SNIP >

Nov 12 '05 #10

P: n/a
Thank you very much for your responses. I am sorry to be dense,but this is my first real
crack at an Access application, and some of the fine points require a bit of learning.

Again, thank you all very much

John Baker
Nov 12 '05 #11

P: n/a
DFS
You'll need to write a bit of code to move the text boxes around on the form
if there's no address line 2.

Something like:

if isnull(me.addressLine2) then
me.addressLine2.visible = false
me.city.top = me.addressLine1.top + me.addressLine1.height + 25
me.state.top = me.addressLine1.top + me.addressLine1.height + 25
me.zip.top = me.addressLine1.top + me.addressLine1.height + 25
endif

I don't use them very often, but if your form is opened in continuous mode,
you may also need to reset the text box positions when Address Line 2 is
populated.

if not isnull(me.addressLine2) then
me.addressLine2.visible = true
me.addressLine2.top = me.addressLine1.top + me.addressLine1.height + 25
me.city.top = me.addressLine2.top + me.addressLine2.height + 25
me.state.top = me.addressLine2.top + me.addressLine2.height + 25
me.zip.top = me.addressLine2.top + me.addressLine2.height + 25
endif


"John Baker" <Ba******@Verizon.net> wrote in message
news:ga********************************@4ax.com...
Hi:

I have a form which contains the following entry ( one element on each line)
Name
Address line 1
Address line 2
city, state, zip

In many cases there is only ONE address line filled in (the other is for apartment numbers and things). The way the form works now, the name is followed by address line one (completed with data) and then a blank line followed by the city state and zip. It looks scattered and untidy.

Is there any way to vertically compress this so that when a line is blank it does not appear or use a line on the form? This would make the form look a great deal tidier.
Thanks

John Baker

Nov 12 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.