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

concatenated form fields

P: n/a
Hello Group,

I have 2 text fields that I would like to concatenate for use in a table.
One field is an ordinary text box. The other is a simple combo box which I
use to select one of about ten items.

The ordinary text field is: NewLongDescription
(This is a memo field that contains descriptions of dolls sold in an e-comm
site)

The combobox is: Default Hair Color
It gets information from a table called: DefaultHairColorTable
(this table contains various hair colors for dolls)

I thought I could just type the following in the LongDescription text box in
the design view:
LongDescription=[NewLongDescription]&" "&"Stock Hair Color (if any):"&"
"&[Default Hair Color]

but the form displays: #Name?

What am I missing?

I hope you can help shed some light on what i am doing wrong.

Thanks
~Bruce
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
B Love wrote:
Hello Group,

I have 2 text fields that I would like to concatenate for use in a table.
One field is an ordinary text box. The other is a simple combo box which I
use to select one of about ten items.

The ordinary text field is: NewLongDescription
(This is a memo field that contains descriptions of dolls sold in an e-comm
site)

The combobox is: Default Hair Color
It gets information from a table called: DefaultHairColorTable
(this table contains various hair colors for dolls)

I thought I could just type the following in the LongDescription text box in
the design view:
LongDescription=[NewLongDescription]&" "&"Stock Hair Color (if any):"&"
"&[Default Hair Color]

but the form displays: #Name?

What am I missing?

I hope you can help shed some light on what i am doing wrong.

Thanks
~Bruce

Buce;

As control source in an UNBOUND control:

=[NewLongDescription] & " " & "Stock Hair Color (if any): " & [Default
Hair Color]

NOT..
LongDescription = [NewLongDescription] etc.

Notice I've also simply added the space after "(if any): "
to avoid the extra & " " & you have used.

Make sure the name of the control is not the same as the name of any
field used in it's control source expression. If you use an unbound
control (as I have suggested above) whenever you use an expression you
will not have any problem.
If you convert the control source of a bound control, and neglect to
change the control name, you will get an error,)

I don't know what you mean when you say you want to 'concatenate for use
in a table.'

Calculated data, (meaning concatenated in this instance) should NOT be
saved in any table. Whenever you need the concatenated text, just
re-concatenate it, in a form, a query, or in a report, as above.

--
Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.
Nov 12 '05 #2

P: n/a

"fredg" <fg******@example.invalid> wrote in message
news:e0**********************@bgtnsc05-news.ops.worldnet.att.net...
B Love wrote:
Hello Group,

I have 2 text fields that I would like to concatenate for use in a table. One field is an ordinary text box. The other is a simple combo box which I use to select one of about ten items.

The ordinary text field is: NewLongDescription
(This is a memo field that contains descriptions of dolls sold in an e-comm site)

The combobox is: Default Hair Color
It gets information from a table called: DefaultHairColorTable
(this table contains various hair colors for dolls)

I thought I could just type the following in the LongDescription text box in the design view:
LongDescription=[NewLongDescription]&" "&"Stock Hair Color (if any):"&"
"&[Default Hair Color]

but the form displays: #Name?

What am I missing?

I hope you can help shed some light on what i am doing wrong.

Thanks
~Bruce
Buce;

As control source in an UNBOUND control:

=[NewLongDescription] & " " & "Stock Hair Color (if any): " & [Default
Hair Color]

NOT..
LongDescription = [NewLongDescription] etc.

Notice I've also simply added the space after "(if any): "
to avoid the extra & " " & you have used.

Make sure the name of the control is not the same as the name of any
field used in it's control source expression. If you use an unbound
control (as I have suggested above) whenever you use an expression you
will not have any problem.
If you convert the control source of a bound control, and neglect to
change the control name, you will get an error,)

I don't know what you mean when you say you want to 'concatenate for use
in a table.'

Calculated data, (meaning concatenated in this instance) should NOT be
saved in any table. Whenever you need the concatenated text, just
re-concatenate it, in a form, a query, or in a report, as above.

--
Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.


Fred:

Thanks for the tip. After I took some spaces out of the "DefaultHairColor"
field and implemented the mod you suggested, I was able to make a calculated
(concatenated) field. I my application I really needed to make this
calculated field a field that would be recorded to the underlying table.
With some minor VB coding, I was able to accomplish this. I realize that in
most circumstances this is probably not the proper way to build a database,
but honestly, it was appropriate in this case.

If you are interested, here is what I did:

When either NewLongDescription or DefaultHairColor lost focus, the following
now occurs:

Private Sub DefaultHairColor_LostFocus()
Me!DefaultHairColor.Requery
Me![LongDescription] = Me![ConcatDescript]
End Sub

Private Sub NewLongDescription_LostFocus()
Me!NewLongDescription.Requery
Me![LongDescription] = Me![ConcatDescript]
End Sub

The result is that the calculated (unbound) field (ConcatDescript) gets
loaded into a bound field called LongDescription when either of the two user
entry fields lose focus after an update (NewLongDescription or
DefaultHairColor). Bottom line is that it works (is loaded into the
underlying table). One thing I want to add to the code ( which I am unsure
just how to do) is to test yet another field to see if the product line is
one of several types and based on the results, either concatenate with:

=[NewLongDescription] & " " & "Stock Hair Color (if any): " &
[DefaultHairColor]

or (because the other products do not have hair) concatenate as follows:
=[NewLongDescription] & " "

As an example, my ProductLine field has several lines of dolls including
Lizzie High. ProductLine also include Lizzie's Cottage Furniture (which
definitely do not have hair). So I can distinguish between the lines that
would and wouldn't have hair options and therefore I should be able to use
some sort of branch to implement appropriately.
Since my VB is not all that good, maybe you or someone else in here might
have some ideas?

Thanks again Fred!
~Bruce
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.