473,385 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to combine five data fields into one string for a new field

First of all, please let me apologize in advance for my lack of technical knowledge and proper terminology skills when it comes to databases. I have never taken any classes, but have only felt my way around by trial and error, hook and by crook, and mimicry. In other words, I have just enough knowledge to know I don’t know anything and to get me into trouble. But here goes…

I am using Access 2007. I have five fields in a table named TblComponents. The fields are named:

[OpportunityRef] – a company-assigned reference number
[Customer] – Control Source for the 1st of 3 cascading combo boxes called cboCustomers in the bound form named Components
[Division] – Control Source for the 2nd of 3 cascading combo boxes called cboDivisions
[Location] – Control Source for the 3rd of 3 cascading combo boxes called cboLocations
[Program] – text usually consisting of many words

Besides needing these fields as individual pieces of data for each of our products or “components” throughout the database, our company uses a unique tag name to reference each component in all correspondence. This tag name is made up from a string of identifying data and is joined together with dashes, namely [OpportunityRef]–[Customer]–[Division]–[Location]–[Program]. So a tag name might look like this:

0098457–All Star Systems–Technical Services–Dallas, TX–Zebra Flight Struts/Multi-Mission Project

I would like to create a field which is automatically populated from the five table fields, with dashes added in between, which effectively builds the tag name for the user. I would like to be able to access this field from both the table itself and the form.

Is this possible? How would I accomplish this?

I would also like to ask another question. Our company uses a lot of dashes and slashes in our daily written business. Do these characters create problems in Access. If so, is there a work around for that so to speak?

Thanks in advance for any and all help received!
Jul 23 '10 #1

✓ answered by NeoPa

It is possible to do what you request, but rarely recommended as it introduces a level of de-normalisation into the design (See Normalisation and Table structures). Let me know if you feel you absolutely must duplicate this data and I will help anyway.

An alternative approach would be to use an unbound TextBox (or Label even depending on your actual usage) on your form, and any other object that requires this same value, which is made up of the concatenated values of the other controls as you require (similar in many respects to what DPatel suggested).

The Control Source would be something like :
Expand|Select|Wrap|Line Numbers
  1. =[OpportunityRef] & '-' &
  2.  [cboCustomers] & '-' &
  3.  [cboDivisions] & '-' &
  4.  [cboLocations] & '-' &
  5.  [Program]
I've shown it on separate lines just to display easily but in normal usage this would be a single line.

8 4016
You can use the following [OpportunityRef]&"–"&[Customer]&"–"&[Division]&"–"&[Location]&"–"&[Program].
Also, regarding - and /, it all depends on what you are planning to do
Jul 23 '10 #2
Thanks for your quick reply! I hate to sound even more ignorant, but on what, how, and where would I use what you typed? I'm afraid I wasn't kidding about not knowing anything.

Thanks!
Jul 23 '10 #3
NeoPa
32,556 Expert Mod 16PB
It is possible to do what you request, but rarely recommended as it introduces a level of de-normalisation into the design (See Normalisation and Table structures). Let me know if you feel you absolutely must duplicate this data and I will help anyway.

An alternative approach would be to use an unbound TextBox (or Label even depending on your actual usage) on your form, and any other object that requires this same value, which is made up of the concatenated values of the other controls as you require (similar in many respects to what DPatel suggested).

The Control Source would be something like :
Expand|Select|Wrap|Line Numbers
  1. =[OpportunityRef] & '-' &
  2.  [cboCustomers] & '-' &
  3.  [cboDivisions] & '-' &
  4.  [cboLocations] & '-' &
  5.  [Program]
I've shown it on separate lines just to display easily but in normal usage this would be a single line.
Jul 24 '10 #4
@datsandgirl
You can do this either in a new query or if you have a field in a table called "TAG" then do this in an update qry
Jul 24 '10 #5
NeoPa
32,556 Expert Mod 16PB
dpatel1682: or if you have a field in a table called "TAG" then do this in an update qry
Or not. This is not recommended for the reasons explained in the link.
Jul 24 '10 #6
@NeoPa
Beautiful, perfect NeoPa! This is just what I needed. The biggest purpose of this request was to provide a way for the user to be able to quickly and easily copy and paste this combersome tag name into correspondence. Thank you and dpatel for all your time and help!
Jul 26 '10 #7
NeoPa
32,556 Expert Mod 16PB
You're very welcome :)

I'm pleased we were able to help.
Jul 26 '10 #8
NeoPa
32,556 Expert Mod 16PB
A new thread has been split from this one and deals with the question of Cascading Filtering.

Any interested parties can find it there.
Jul 28 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ken Fine | last post by:
I want to take the contents of many fields of various datatypes (varchars and text) and combine them into a single "junk" field that I will perform SQL Server free text searching upon, e.g.: ...
0
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get...
1
by: mojo | last post by:
We have set up an Access database with tables x,y, & z where we would like to have multiple people entering data into a table x. Each person has an identical copy of the database on their PC's. ...
0
by: Pavils Jurjans | last post by:
Hello, I have a third-paty application that uses text type field in MSSQL server to store data of incoming emails (full raw sources, including headers, etc.). Since the emails come in different...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
14
by: TIonLI | last post by:
I am working with a table that lists dates and corresponding times in separate fields. For purposes of building a query to calculate elapsed time I would like to combine a field with a field ending...
0
by: sijugeo | last post by:
Hi, I Have a MS word template field which have certain data fields. I want to populate the data fields using the data retrived from SQL db. How can I do this? Thanks in advance Siju george
1
by: Will | last post by:
Hi, This is might be a basic question, but is it possible to hold multiple pieces of data in one field? I am adpating a database which compares multiple projects against a number of criteria....
13
by: Desitech | last post by:
I want to create a command button on a form that will populate a certain field in a certain table for that record with a hyperlink address (just the text) and add another field from that record to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.