473,402 Members | 2,055 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,402 software developers and data experts.

Invert Unequal Dataset

Hello,

I'm stuck!
I have received help before and progressed greatly from your(Access
Group) answers. I need some again please. Thanks in advance for any
suggestions.

Problem: Take the following dataset

Number Date W V
50200401 01/02/04 43.1 4
51200402 02/03/04 80.2 4
51200402 22/03/04 85.8 4
51200402 02/04/04 84.2 3

and transform it thus:

Number Date W V Date W V Date W V
50200401 01/02/04 43.1 4
51200402 02/03/04 80.2 4 22/03/04 85.8 4 02/04/04 84.2 3

There can be upto 10 entries under the number colum per number. Thus
Date W V headings would repeat for each entry.

I hope I have explained myself clearly.

Thank you,

osmethod
Nov 13 '05 #1
2 1679
Aircode to return a string containing the results for each number. You can
then create a query into just the table that has the number as primary key,
and use the function to list the child records beside it:

Function ConcatDetail(Num As Long) As Variant
Dim rs As DAO.Recordset
Dim strOut As String
Dim strSql As String
Dim lngLen As Long
Const strcSep = "; "

strSql = "SELECT Date, W, V FROM Table1 WHERE Number = " & Num & ";"
Set rs = dbEngine(0)(0).OpenRecordset(strSql)
With rs
Do While Not .EOF
strOut = strOut & !Date & strcSep & !W & strcSep & !V & strcSep
.MoveNext
Loop
End With
rs.Close

lngLen = Len(strOut) - Len(strcSep) 'Without trailing separator.
If lngLen > 0 Then
ConcatDetail = Left(strOut, lngLen)
Else
ConcatDetail = Null
End If
Set rs = Nothing
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"osmethod" <os******@eircom.net> wrote in message
news:9c**************************@posting.google.c om...

I'm stuck!
I have received help before and progressed greatly from your(Access
Group) answers. I need some again please. Thanks in advance for any
suggestions.

Problem: Take the following dataset

Number Date W V
50200401 01/02/04 43.1 4
51200402 02/03/04 80.2 4
51200402 22/03/04 85.8 4
51200402 02/04/04 84.2 3

and transform it thus:

Number Date W V Date W V Date W V
50200401 01/02/04 43.1 4
51200402 02/03/04 80.2 4 22/03/04 85.8 4 02/04/04 84.2 3

There can be upto 10 entries under the number colum per number. Thus
Date W V headings would repeat for each entry.

I hope I have explained myself clearly.

Thank you,

osmethod

Nov 13 '05 #2
Thank you Allen... Got your function to work nicely...

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Des Small | last post by:
Lately I have found myself using a pattern to make new dictionaries quite often, by which I mean twice: def invert(d): nd = {} ).append(key) for k, v in d] return nd def count(l): d = {}
5
by: Me Padre | last post by:
Hoping someone can help with this. I know I can do this programatically using a loop but I thought there might be some easier or more effective way. I am trying to invert an array. i.e. ...
3
by: Peter Aitken | last post by:
I want to invert all the bits (all 0s to 1s, all 1s to 0s) in a type ushort. I though I would use the complement operator ~ but the compiler won't buy it. How can I do this? Thanks, --...
4
by: Derek Martin | last post by:
Hi List, I have an arraylist of objects. I have created my own IComparable in the object to return the sort on datetime. This works great! Now, I'd like to invert the sort. Currently, it gives...
0
by: intractably | last post by:
Hope this helps... public void InvertDS(ref DataSet ds) { try { DataSet ds2 = new DataSet(); ds2.Tables.Add(); ds2.Tables.Columns.Add(); ds2.Tables.Columns.Add();
41
by: rick | last post by:
Why can't Python have a reverse() function/method like Ruby? Python: x = 'a_string' # Reverse the string print x Ruby: x = 'a_string' # Reverse the string
1
by: mahesh.nimbalkar | last post by:
Hi, I have color as System.Drawing.Color c1 object as background color. Now I would like to get another System.Drawing.Color c2 object which is invert of c1 color to be used as foreground...
0
by: Karthik | last post by:
Hi, I want to record a sound wave from a mic and at the same time invert it and play the inverted wave.My code goes as follows, however nothing is written into the E:\inverted.wav file.Thanks in...
2
by: Stef Mientki | last post by:
hello, from the manual I read that a bitwise inversion should be done by invert. But from some experiments I see that not works equally well. Is this coincidence ? (The disadvantage of invert...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.