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 1245 ADezii 8,834
Recognized Expert Expert
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.
ADezii 8,834
Recognized Expert Expert
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 data in the form is linked from a one-to-many table relationship.
In this instance, I really can't sum the value from the one's table
since if there...
|
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 Create a Dynamic Crosstab Report
PRODUCT :Microsoft Access
PROD/VER:1.00 1.10
OPER/SYS:WINDOWS
|
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 report runs?
Thank you.
Greg Teets
|
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 new alarm is
entered on the subform, I want to print a report that shows the general
information and the alarms that were entered.
The record source...
|
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 on a
separate ASP page). Here is the code behind the button that will
launch the report (is in a file called StateSelect.aspx.vb:
Protected Sub...
| |
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 page i have a
link "Export to Excel", on the click of which the report is getting saved in
excel. The code is:
Response.ContentType =...
|
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 problem is that the database-stored Proc could take anything between
10 secs - to - 10 mins. I dont want the page to time out . Is there a way, like 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 is run again? This is causing
certain error problems.
1 Why does the code run for a print preview when the report already
exists?
2 What...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |