combine fields on form into summary

D

DRBE

I'd be grateful for advice for someone new to databases.
using ms access 2000, I am trying to create a form that will allow drop down
fields to be put together into preformatted text to form a summary field. I
achieved this using advice in helpfiles. The Summary form control is set
with control source = and then using form fields and & to create the summary.
This has worked well. However I then need to save this summary to a table
field, and I have struggled with this step.

The summary is planned to be saved in the same table as a memo field as the
rest of the form fields. The idea being that if the preformatted text
doesn't exactly match the scenario, I can use freetext to edit the summary
field. Ideally while still in the orginal Form.

Eventually multiple summaries will be put together in a report.

as pointed out, the summary needs to be editable in case the preformatted
text doesn't quite fit an individual description, so can't just be done
automatically as part of the report.

Thanks in advance
Bruce
 
T

tina

The Summary form control is set
with control source = and then using form fields and & to create the
summary

this won't work if you need to edit the text, because using an expression in
a control's ControlSource property makes it a "calculated control", whic is
by definition not updateable. instead, you can use the expression in VBA to
set the value of a control bound to the table field you want to store the
data in. then the data can be edited while the form is open. the code would
be something like

Me!TextboxName = Me!cbo1Name & Me!cbo2Name

where you place the code depends on when you want the text field to be
updated with the concatenated text.

hth
 
D

DRBE

Thanks, I linked you suggestion to a "submit" button which seems to work well.
Later on I might try to be clever and link each statement to add as it is
clicked, but for the moment this works well until I get my database up and
running.

Thanks again
 
T

tina

you're welcome. and btw, you can add each combobox selection as it is made
by adding code to the AfterUpdate event procedure of each combobox, as

Me!TextboxName = Me!TextboxName & Me!cboName

that adds the selection made in the "current" combobox control to the end of
whatever value is already in the textbox.

hth
 
D

DRBE

Even better!
is there a way of including a line break for the text within the code (like
the <br> in html). It worked when I used a line break in the field box.

eg
Summary = "The " & [accident] & " occured in the morning. " & LINEBREAK &
"The road was " & [roadcondition]"

kind regards
Bruce
 
T

tina

hmm, i honestly don't know. you might try adding "..morning. " & Chr(13) &
Chr(10) & "The road...". i don't know if that will insert a hard break into
a Text field though, or just a weird little box that shows up in the text.

actually, it seems like an odd requirement in the first place. why do you
want hard breaks in the text? that defeats the advantage provided by the
flexibility of line wrap when you display the text in various-sized controls
in forms and reports.

hth


DRBE said:
Even better!
is there a way of including a line break for the text within the code (like
the <br> in html). It worked when I used a line break in the field box.

eg
Summary = "The " & [accident] & " occured in the morning. " & LINEBREAK &
"The road was " & [roadcondition]"

kind regards
Bruce

tina said:
you're welcome. and btw, you can add each combobox selection as it is made
by adding code to the AfterUpdate event procedure of each combobox, as

Me!TextboxName = Me!TextboxName & Me!cboName

that adds the selection made in the "current" combobox control to the end of
whatever value is already in the textbox.

hth


work
well. whic
is VBA
to store
the code
would is
set field
as
 
L

Linq Adams via AccessMonster.com

For LINEBREAK you'd use vbNewLine.

Summary = "The " & [accident] & " occured in the morning. " & vbNewLine &
"The road was " & [roadcondition]"
 

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