I have code that pulls from a database and inputs into an excel sheet (shown below).
The way the database is setup, it only can record a certain amount of characters per line and so I get multiple lines for one record (example below)
[TABLE="class: grid, width: 300, align: left"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[/TR]
[TR]
[TD]Ticket
[/TD]
[TD]Description
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]test
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]CN 11: 1-22 check 1.3504 or
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD].0084 o/max; CN 10: S/N 14
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]check 0.0303 or .003 o/max
[/TD]
[/TR]
</tbody>[/TABLE]
I would like the query to say something like "If there is a duplicate value in column A, combine all the text in the corresponding cells into one line."
So instead of having it like it is shown directly above, it would come out like this:
[TABLE="class: grid, width: 700, align: left"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[/TR]
[TR]
[TD]Ticket
[/TD]
[TD]Description
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]test
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]CN 11: 1-22 check 1.3504 or .0084 o/max; CN 10: S/N 14 check 0.0303 or .003 o/max
[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Selectstring = "SELECT " & c.Item("Ticket1") & _
", " & c.Item("Description")
fromString = "FROM " & ibmLib1 & "." & t.Item("NCType") & " " & t.Item("NCType") & _
", " & ibmLib1 & "." & t.Item("NCRs") & " " & t.Item("NCRs")
whereString = "WHERE " & c.Item("Ticket3") & "=" & c.Item("Ticket1")
strSql = Selectstring & " " & fromString & " " & whereString
'################PERFORM THE QUERY################
Set conn = Open400Conn()
Set rs = Query(conn, strSql)
descTab.Range("A1").Value = "Ticket"
descTab.Range("B1").Value = "Description"
descTab.Range("A2").CopyFromRecordset (rs)
conn.Close
The way the database is setup, it only can record a certain amount of characters per line and so I get multiple lines for one record (example below)
[TABLE="class: grid, width: 300, align: left"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[/TR]
[TR]
[TD]Ticket
[/TD]
[TD]Description
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]test
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]CN 11: 1-22 check 1.3504 or
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD].0084 o/max; CN 10: S/N 14
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]check 0.0303 or .003 o/max
[/TD]
[/TR]
</tbody>[/TABLE]
I would like the query to say something like "If there is a duplicate value in column A, combine all the text in the corresponding cells into one line."
So instead of having it like it is shown directly above, it would come out like this:
[TABLE="class: grid, width: 700, align: left"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[/TR]
[TR]
[TD]Ticket
[/TD]
[TD]Description
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]test
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]CN 11: 1-22 check 1.3504 or .0084 o/max; CN 10: S/N 14 check 0.0303 or .003 o/max
[/TD]
[/TR]
</tbody>[/TABLE]