[AccessD] Display Data Horizontally

David McAfee dmcafee at pacbell.net
Tue Dec 13 16:03:07 CST 2005


Yes, or you can create a function to do it for you. Then place the text box
on a form or any report and make its source =
YourFunctionName(SomeParameterIfNecerssary)

and the function can return as text, like this (warning untested OTTOMH
code):

Public Function ListToString(SomeValue as int) as string
Dim Output As string
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("SELECT City FROM tblCities WHERE RegionCode = "
SomeValue)
If rst.BOF And rst.EOF Then
    Output = ""
Else
    rst.MoveLast
    Do Until rst.eof
	OutPut = Output & ", " & rst![City]
	rst.MoveNext
    Loop
    'Might have to trim leading or lagging commas here
	Output = Right(Output, Len(Output) -2
End If

ListToString = Output

rst.Close
Set rst = Nothing
db.Close

End Function



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Boyd, Mark
Thomas (US - Philadelphia)
Sent: Tuesday, December 13, 2005 1:12 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Display Data Horizontally


Where do I code this?   In the Detail_Format event of the report?


Mark Boyd
Senior Consultant
Enterprise Risk Services
Deloitte & Touche LLP

Tel: +1 215 405 5576
mboyd at deloitte.com
www.deloitte.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David Mcafee
Sent: Tuesday, December 13, 2005 3:59 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Display Data Horizontally

well, if thats all you want to do, you only need  one field. The report
doesn't need to be bound. Open a recordset and  loop through the records
and build a string by adding  strMyRS =  strMyRS &  ", " inside the
loop.

"Boyd, Mark Thomas (US - Philadelphia)" <mboyd at deloitte.com> wrote:
Thanks Reuben.  I can use the columns to set up the data to display
horizontally, but I can't format it so the fields display together, with
commas separating them.  For example, I'd like the data to appear as
"Boston, Philadelphia, Seattle".

Thanks again for the sample report.


Mark Boyd
Senior Consultant
Enterprise Risk Services
Deloitte & Touche LLP

Tel: +1 215 405 5576
mboyd at deloitte.com
www.deloitte.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Reuben
Cummings
Sent: Tuesday, December 13, 2005 3:16 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Display Data Horizontally

Mark, I just sent you a sample report that I use that prints in columns.
Check out the code and page setup.

Reuben Cummings
GFC, LLC
812.523.1017


> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Boyd, Mark
> Thomas (US - Philadelphia)
> Sent: Tuesday, December 13, 2005 12:30 PM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] Display Data Horizontally
>
>
> I need to display a table's data horizontally on a report.
> For example, I have the following data in my table:
>
> Boston
> Philadelphia
> Seattle
>
> I need the report's detail section to display "Boston, Philadelphia,
> Seattle".
>
> Any ideas?
> Thanks.
>
> Mark Boyd
> Senior Consultant
> Enterprise Risk Services
> Deloitte & Touche LLP
>
> Tel: +1 215 405 5576
> mboyd at deloitte.com
> www.deloitte.com
>
>
> This message (including any attachments) contains confidential
> information intended for a specific individual and purpose, and
> is protected by law.  If you are not the intended recipient, you
> should delete this message.
>
>
> Any disclosure, copying, or distribution of this message, or the
> taking of any action based on it, is strictly prohibited. [v.E.1]
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list