writing to a text box from vb code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

using Access2003, i have a form "form1" with a text box "MyMessages" on it.
The text box is the same size as the form.

when the form opens i want the text box to display several different
messages all at once.

for example my code is something like:

Forms!Form1.MyMessages = "Good Morning"
Forms!Form1.MyMessages = "Todays Date is " & date()
Forms!Form1.MyMessages = "You have 0 Invoices that has expired"

this works ok but each line of code overwrites itself, so instead of having
3 lines of text in my text box i only have the last line of code. Is their a
method of being able to display all lines of code without it overwriting
itself?
 
StuJol said:
using Access2003, i have a form "form1" with a text box "MyMessages" on it.
The text box is the same size as the form.

when the form opens i want the text box to display several different
messages all at once.

for example my code is something like:

Forms!Form1.MyMessages = "Good Morning"
Forms!Form1.MyMessages = "Todays Date is " & date()
Forms!Form1.MyMessages = "You have 0 Invoices that has expired"

this works ok but each line of code overwrites itself, so instead of having
3 lines of text in my text box i only have the last line of code. Is their a
method of being able to display all lines of code without it overwriting
itself?

On each line include itself first.

Forms!Form1.MyMessages = "Good Morning"
Forms!Form1.MyMessages = Forms!Form1.MyMessages & vbCrLf & "Todays Date is " &
date()
Forms!Form1.MyMessages = Forms!Form1.MyMessages & vbCrLf & "You have 0 Invoices
that has expired"
 

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

Back
Top