User makes up a report

  • Thread starter Thread starter Spinner
  • Start date Start date
S

Spinner

Guest
Is there away to make a report where the user selects a bunch of field from tables, and these field are displayed on a report.
 
Ok, this is a tough subject... Here is a solution for you... Kind of rough... and will take some work to perfect... but setup a form with a multi-select listbox(mine's called lstFields). Set the source equal to the field list of the table you're looking for... In my example "Table1". Set a command button on the form and here is the onClick sub..

Private Sub cmdCreate_Click()
Dim ValueList(50) As String
Dim NewRep As Report
Dim ctr, ctr2
Dim varItem
Dim frm As Form
Dim ctl As Control

ctr2 = 1

For Each varItem In lstFields.ItemsSelected
ValueList(ctr2) = lstFields.ItemData(varItem)
ctr2 = ctr2 + 1
Next varItem



Set NewRep = CreateReport
NewRep.RecordSource = "Table1"
DoCmd.Restore
For ctr = 1 To ctr2 - 1
Set ctl = CreateReportControl(NewRep.Name, acTextBox, acDetail, , , 1250 * ctr)
ctl.ControlSource = ValueList(ctr)
Next

End Sub

Hope this will get you started.....

Doug
 
Hello Doug

I came across your reply the above message back in 2001 as I am interested in doing the same thing in my db.

After days of searching for this peice of information, I asked myself why hasn't Microsoft enabled this to happen easier in the newer versions of Access. I am using 2000 and was hoping their was an easier way. Do you have any suggestions?

Would it also be possible to view your code for this particular subject (if you still have it). I know it seems as though I am trying to get the hard work done for me, but as usual I am working on a tight timeframe but am very interested to find out how this works.

Your cooperation would be very much appreciated.

Regards
Smilla
 

Users who are viewing this thread

Back
Top Bottom