Combining fields

T

tom

I am very new to access and very large databases.

In access 2007, In a query, I am trying to combine (4) fields (Fields 1 - 4)
from table 1, in order to create a unique material code for material number
analysis.

TFTH,
 
G

George

You can concatenate multiple fields together for display on a form or
report.

Depending on where you will use it, the exact syntax varies, but it would
basically be:

Field1 & Field2 & Field3 & Field4

This would place all four fields together with no delimiters between them.

If you want to seperate them with a delimiter, such as the dash:

Field1 & "-" & Field2 & "-" & Field3 & "-" & Field4

Now, if this is going into a control on a form or report, you could create
the control (a text box) and make its control source

= Field1 & "-" & Field2 & "-" & Field3 & "-" & Field4

If this is going to be a column in a query, you could create it in one of
the columns:

Material Code: Field1 & "-" & Field2 & "-" & Field3 & "-" & Field4


HTH

George
 
B

boblarson

In a query you can concatenate them to create a single field:

MyNewFieldName:[Field1] & [Field2] & [Field3] & [Field4]

And if you need a character between -

MyNewFieldName:[Field1] & [Field2] & "-" [Field3] & [Field4]
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com

__________________________________
 
G

George

LOl. It's harder to see here, though. At least at UA, we get a warning when
that happens.
 
A

aaron.kempf

If you were just using SQL Server-- then you could make a computed
column out of those four fields.. and you'd never have to deal with
the complexities ever again (because it would show up as a single
column in the table).

-Aaron
 
G

George

If the poster had asked about how to create a computed column in SQL Sever,
your answer would be aprropriate, wouldn't it?


If you were just using SQL Server-- then you could make a computed
column out of those four fields.. and you'd never have to deal with
the complexities ever again (because it would show up as a single
column in the table).

-Aaron
 
D

Debbie C

I have 3 Fields re: Volume, Page, and Inst Type that I want to combine in a
report.
Exactly how do I get it to appear as EX: 152/348 WD, on the report.
 
J

John Spencer

Set the control source of a textbox to
= [Volume] & "/" & [Page] & " " [Inst]

Make sure the textbox is named something other than Volume, Page, or Inst.

By the way Page is a bad name for a field as it could be mistaken for
the Page function which returns the number of the current page. A
better name would be PageNumber or PageNo.


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Top