By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 2,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

dynamic report columns

P: n/a
Hi All,

Has anyone come across or have code where a user can select what data
fields they want(lets say from a multi-select list box) and have them
be the columns in a report.

thanks
bobh.
Mar 14 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
bobh wrote:
Hi All,

Has anyone come across or have code where a user can select what data
fields they want(lets say from a multi-select list box) and have them
be the columns in a report.

thanks
bobh.
Hi Bob:

The following link is for a different type of problem but I think some
of the concepts you learn there can be applied to your probem. (For
those of you doing crosstab reports it's really a good/great article.)
http://www.fmsinc.com/tpapers/access...hly/index.html

Could you describe your problem a bit more fully. Let's say you have
1/1/2008, 1/2/2008...1/31/2008 in a listbox, do you have table columns
with those field names? Or did you want to print those dates in
respective column positions?

For a listbox, you should be able to check the selected property and
create a string.
Dim strD As String
Dim intFor As Integer
Dim I As Integer
'has col header, this start at 1
For intFor = 1 To Me.ListBox.ListCount - 1
If Me.ListBox.Selected(intFor) = True Then
'create a string 01/01/2008 As Month1...Monthn
strD = strd & Me.ListBox.Column(0, intFor) & _
" As Month" & i & ", "
End If
Next

You can open up the report and change the recordsource for it.

I think if your problem was described a bit more verbosely you'll get a
better answer.

Maladum
http://www.youtube.com/watch?v=Ym9z3MBjwho

Mar 14 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.