View Single Post
  #3  
Old May 28th, 2010, 11:17 PM posted to microsoft.public.access.reports
Sam
external usenet poster
 
Posts: 855
Default PLEASE HELP: Refresh columns displayed in a report from a quer

Hi Marshall, Thanks for helping

In the following code you gave:

With Forms!theform
Me.txtSelect1.ControlSource = .txtSelect1
. . .
End With

Me.txtSelect1.ControlSource is refering to the column header in the report?
and Forms!theform.txtSelect1 is the field from the form?

If I have the right understanding, once I do the above code: then I open the
report with: DoCmd.OpenReport "Student Report", acViewReport, , strWhere1 &
strWhere2


Thanks again.








"Marshall Barton" wrote:

sam wrote:
I have a report whose record source is a query, the query consists of
dynamic Select and Where clause and so the columns are user driven (based on
what user selects on a form)

I am able to display the data to the report, however I am not able to
refresh the columns in the report, For eg:

My SQL is:

strSQL = Select Student_Id, Student_FName, Student_LName & strSelect1 &
strSelect2 & strSelect3 FROM Students_Table WHRE strWhere1, strWhere2,
strWhere3

Now, I am able to display the specific columns in the query based on what
users select in addition with Student_Id, Student_FName, Student_LName
columns, However I am not able to do the same with the report, I am not able
to display the additional columns that user selects in the form in the report
(strSelect1 & strSelect2 & strSelect3)

I have assigned this command to a button to generate the report:

DoCmd.OpenReport "Student Report", acViewReport, , strWhere1 & strWhere2 &
strWhere3


Assuming the strSelect# strings contain a leading comma and
the strWhere# strings conatain " AND " in all but the first
or last string, I guess you question is how to bind report
text boxes to the specifisl fields. If so, use the report's
Open event to do it:

With Forms!theform
Me.txtSelect1.ControlSource = .txtSelect1
. . .
End With

--
Marsh
MVP [MS Access]
.