Poking info into a Memo box

J

johnb

Hi all. I seem to have lost a question. So I'll have another go.

I have an unbound combo box with about 30 lines. And I need to insert
several of these lines into a memo box on the same form. Each one starting in
the lefthand column. So I thought use the combos AfterUpdate to insert each
selected line into the memobox. It works ok but I get a blank first line and
small squares at the end if each line. The code is Me.GlazingInfo =
Me.GlazingInfo & Chr(13) & Chr(10) + Me.Combo165

Question: How do I remove the blank line and remove the little square. and
Second How get the memobox to autoexpand as the number of entries increase?
Can Grow does not work.
TIA
John B
 
F

fredg

Hi all. I seem to have lost a question. So I'll have another go.

I have an unbound combo box with about 30 lines. And I need to insert
several of these lines into a memo box on the same form. Each one starting in
the lefthand column. So I thought use the combos AfterUpdate to insert each
selected line into the memobox. It works ok but I get a blank first line and
small squares at the end if each line. The code is Me.GlazingInfo =
Me.GlazingInfo & Chr(13) & Chr(10) + Me.Combo165

Question: How do I remove the blank line and remove the little square. and
Second How get the memobox to autoexpand as the number of entries increase?
Can Grow does not work.
TIA
John B

As I read your code, you're appending chr(13) to the existing Memo
field then adding chr(10) plus the value in Me.Combo165 together.
I don't think that is what you mean to do.
Try:
Me.GlazingInfo = Me.GlazingInfo & Chr(13) & Chr(10) & Me.Combo165
That should take care of the squares (on new data entry. You'll have
to run an update query on existing data.).

As far as CanGrow not working, that is correct. CanGrow does NOT work
in form view, only when/if the form is printed (read Access help!).
Use the scroll bars to view the data as needed.
 
D

Douglas J. Steele

fredg said:
As I read your code, you're appending chr(13) to the existing Memo
field then adding chr(10) plus the value in Me.Combo165 together.
I don't think that is what you mean to do.
Try:
Me.GlazingInfo = Me.GlazingInfo & Chr(13) & Chr(10) & Me.Combo165
That should take care of the squares (on new data entry. You'll have
to run an update query on existing data.).

Actually, as long as something's selected in the combo box, Me.GlazingInfo &
Chr(13) & Chr(10) + Me.Combo165 and Me.GlazingInfo & Chr(13) & Chr(10) &
Me.Combo165 should result in the same thing. It's only if nothing's selected
(so that Me.Combo165 evaluates to Null) that there will be a difference: +
propagates Nulls, & doesn't.

However, it is better to use & consistently in this case. In fact, try
Me.GlazingInfo & vbCrLf & Me.Combo165
 
J

johnb

Hi Fred, Doug,
Thank you for the feedback. Using the '& vbCrLf &' removed the small squares
in the memo box. However on poking text from the Combobox to the Memobox I
still get a blank line at the top of the Memobox. How do I stop this
happening?

regards

john
 
D

Douglas J. Steele

It's because you're using

Me.GlazingInfo = Me.GlazingInfo & vbCrLf & Me.Combo165

That puts the blank line before the contents of the combo box.

Try:

Me.GlazingInfo = Me.GlazingInfo & Me.Combo165 & vbCrLf

(assuming you don't mind a blank line at the end), or

Me.GlazingInfo = Me.GlazingInfo & _
IIf(Len(Me.GlazingInfo) > 0, vbCrLf, "") & Me.Combo165
 
J

johnb

Doug your're super star!

Now Then where do I find an example of drag and drop between Forms?
 
D

David W. Fenton

It's because you're using

Me.GlazingInfo = Me.GlazingInfo & vbCrLf & Me.Combo165

That puts the blank line before the contents of the combo box.

This can be very problematic in a multi-user scenario. Putting
multiple lines in a memo field makes it sound like each line would
probably better be stored as a separate record in a different table.
That also eliminates the multi-user problem, as what was previously
a new line in a single memo field is now a new record, independent
of any other records.

I just converted a client app from a single memo field to a memo log
table, precisely because they were having multi-user conflicts and
memo corruption.
 
D

Douglas J. Steele

David W. Fenton said:
This can be very problematic in a multi-user scenario. Putting
multiple lines in a memo field makes it sound like each line would
probably better be stored as a separate record in a different table.
That also eliminates the multi-user problem, as what was previously
a new line in a single memo field is now a new record, independent
of any other records.

I just converted a client app from a single memo field to a memo log
table, precisely because they were having multi-user conflicts and
memo corruption.

No argument from me!
 
J

johnb

David, good point, but currently the db is single user app.

sorry about the delay in responding but a golf course got in the way!

Many thanks
john
 

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