[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

MS Access and rotate data

Posted on 2016-11-02
4
Medium Priority
?
68 Views
Last Modified: 2016-11-02
Is there a way to rotate data in SQL or other mechanism in MS Access?  For example, say I have 3 records of data, say text string of colors  - "blue", "red", "green".   Is there a way to return a concatenation of all three colors in one string in one record?
0
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 500 total points
ID: 41870294
You can use a recordset. This example will replace the last record with the concatenated value.
Sub Demo()
	Dim rs As DAO.Recordset
	Dim str As String

	Set rs = CurrentDb.OpenRecordset("table")

	rs.MoveFirst
	Do Until rs.EOF
		rs.Edit
		str = str & " " & rs!ColorFieldName
		rs.MoveNext
	Loop
	rs!ColorFieldName = str
	rs.Update
	rs.Close
	Set rs = Nothing
End Sub

Open in new window

0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 41870295
0
 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 41870299
Use the following to flatten row data:

https://www.experts-exchange.com/articles/2380/Domain-Aggregate-for-Concatenating-Values-by-Group-in-Microsoft-Access.html

Access does have a crosstab (PIVOT), but nothing to flatten built-in.

Jim.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41870362
Thanks for all the help!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question