Hello all,
I have a table name "info" which looks like,
ProjectID Consultantname
1 Alpha
1 Beta
1 Charlie
2 James
2 Mario
3 Shak
Now im getting a excel report in the below format.
ProjectID Consultantname
1 Alpha
1 Beta
1 Charlie
2 James
2 Mario
3 Shak
I want a excel report which gives the result as below:
ProjectID Consultantname
1 Alpha, Beta, Charlie
2 James, Mario
3 Shak
im struck here n cant proceed further.
Pls help
Thanks,
Shaq
4 1234
Hello all,
I have a table name "info" which looks like,
ProjectID Consultantname
1 Alpha
1 Beta
1 Charlie
2 James
2 Mario
3 Shak
Now im getting a excel report in the below format.
ProjectID Consultantname
1 Alpha
1 Beta
1 Charlie
2 James
2 Mario
3 Shak
I want a excel report which gives the result as below:
ProjectID Consultantname
1 Alpha, Beta, Charlie
2 James, Mario
3 Shak
im struck here n cant proceed further.
Pls help
Thanks,
Shaq
Just subscribing, I'll have your answer either this afternoon or this evening if no one gets to it before me.
Hello all,
I have a table name "info" which looks like,
ProjectID Consultantname
1 Alpha
1 Beta
1 Charlie
2 James
2 Mario
3 Shak
Now im getting a excel report in the below format.
ProjectID Consultantname
1 Alpha
1 Beta
1 Charlie
2 James
2 Mario
3 Shak
I want a excel report which gives the result as below:
ProjectID Consultantname
1 Alpha, Beta, Charlie
2 James, Mario
3 Shak
im struck here n cant proceed further.
Pls help
Thanks,
Shaq
- Create a Table named tblResults. This Table will consist of only 2 Fields with no Primary Key:
- [ProjectID] - [NUMBER] {LONG}
- [Consultant(s)] - [TEXT 255]
- Copy and Paste, then Run the following code from anywhere you like:
- Dim MyDB As DAO.Database, MyRS_ID As DAO.Recordset, strSQL As String
-
Dim MyRS_Info As DAO.Recordset, strInfo As String, rstResults As DAO.Recordset
-
Dim strRestrictID As String, strConsultants As String
-
-
'DELETE any pre-existing Records in tblResults
-
DoCmd.SetWarnings False
-
DoCmd.RunSQL "DELETE * From tblResults;"
-
DoCmd.SetWarnings False
-
-
-
'Get a listing of Unique ProjectIDs
-
strSQL = "SELECT Distinct [ProjectID] From Info Order By [ProjectID];"
-
strInfo = "Select * From Info;":
-
-
Set MyDB = CurrentDb()
-
Set MyRS_ID = MyDB.OpenRecordset(strSQL, dbOpenSnapshot)
-
Set rstResults = MyDB.OpenRecordset("tblResults", dbOpenDynaset)
-
-
Do While Not MyRS_ID.EOF
-
strRestrictID = "SELECT * From Info Where [ProjectID] =" & MyRS_ID![ProjectID]
-
Set MyRS_Info = MyDB.OpenRecordset(strRestrictID, dbOpenSnapshot)
-
Do While Not MyRS_Info.EOF
-
strConsultants = strConsultants & MyRS_Info!ConsultantName & ","
-
MyRS_Info.MoveNext
-
Loop
-
strConsultants = Left(strConsultants, Len(strConsultants) - 1)
-
rstResults.AddNew
-
rstResults![ProjectID] = MyRS_ID![ProjectID]
-
rstResults![Consultant(s)] = strConsultants
-
rstResults.Update
-
strConsultants = "" 'Reset
-
MyRS_Info.MoveFirst
-
MyRS_ID.MoveNext
-
Loop
-
-
MyRS_ID.Close: Set MyRS_ID = Nothing
-
rstResults.Close: Set rstResults = Nothing
-
MyRS_Info.Close: Set MyRS_Info = Nothing
- The data that you requested, in the proper format, will now be contained in tblResults in Ascending ProjectID Order. Since the data is contained within a Table, you can do virtually anything you like with it.
Thanks a lot, that works...
But im having another issue.. which looks similar but a bit messed up.
I have a table as below
ProjID b c d e f
2 12 3 1 2 1
3 10 3 0 2 4
4 5 5 6 5 5
5 4 2 0 0 0
6 1 0 0 1 0
8 0 6 0 7 2
10 0 0 0 0 0
I want a o/p in excel like below...
1st column projID
2nd column should be like this:
b, 12,
c, 3,
d, 1,
e, 2,
f, 1 (in one cell)
like previously we got all Consultants in one cell.
If U can help with this.. I will run short of words to thank :)
Shaq
I got it working... :)
Thanks for helping me with the 1st result.
Regards,
Shaq
Sign in to post your reply or Sign up for a free account.
Similar topics
by: U N Me |
last post by:
I have a continuous form that lists records from a query. One of the
columns is an amount field, In the footer of the form I place a text
box that displays the total (sum) of the amount.
The...
|
by: Nathan Bloomfield |
last post by:
Does anyone know if there is any documentation which relates to Access2k + ?
or can anyone help adjust the code?
I am having trouble converting the DAO references.
TITLE :INF: How to...
|
by: Greg Teets |
last post by:
I am running an Access report from VB via ADO.
The report has a field that shows the date it was run.
How can I return the data from this field to VB or have Access post it
to a table when the...
|
by: kkrizl |
last post by:
I have a form that displays general information about an alarm permit
location. There's a subform that shows detailed information about
burglar alarms that have gone off at the location. When a...
|
by: Brent White |
last post by:
If you need more information, I'd be glad to give it, but I am
developing an ASPX page so that the user can select multiple values for
a specific field, then pass them on (using Crystal Reports 10...
|
by: Spacy |
last post by:
Please help me! I have tried all options. Nothing works!
I have 2 hyperlinks, Report1 & Report2. On click of Report1, a html table
(report) is being displayed on a child frame. On this child...
|
by: devi |
last post by:
Hi,
In oracle I have a LAG function using which I could get the previous
value of a field.
Do we have anything similar to that in SQL Server or access?
Thanks
Devi
|
by: Uday |
last post by:
Hi everyone,
I have a ASP page that triggers a db-side stored procedure. At the end of
the procedure, it spits out a log file, that this ASP page reads and displays
for the users.
But the...
|
by: Gord |
last post by:
When I open a certain report, it runs some code that generates the records
that will be displayed in that report. This works fine. When I go to print
preview the report it appears that the code...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |