View Full Version : Filtering Reports


dknightley
09-11-2007, 08:23 AM
Hi,
I need to be able to filter my report through a form.. ive had a look around at some different methods but cant seem to get any to work.

Any one got any simple methods?

Thanks

David

Uncle Gizmo
09-11-2007, 10:12 AM
Create an SQL statement within your form and pass that to the record source of the report.

dknightley
09-11-2007, 12:25 PM
Thanks, do you have an example? Im pretty new to this thanks

Rich
09-11-2007, 02:47 PM
Use the Where clause of the OpenReport method or base your report on a parameterized query

dknightley
09-12-2007, 01:47 AM
Hi,

I have made some ground using the following syntax:

Private Sub Command0_Click()


DoCmd.OpenReport "Models", acViewPreview, , "Customer = " & Text1


End Sub

However it doesnt work, when i debug it Text1 is = to the correct value entered in teh text box i.e A0007, however the error message says invalid column name A0007. It seems to be picking up teh criteria as the column name.

Any ideas?

Thanks david

Rich
09-12-2007, 02:08 AM
"Customer = " & Me! Text1

dknightley
09-12-2007, 02:17 AM
Are you sure? It gives me a compile error?
Thanks David

Rabbie
09-12-2007, 02:41 AM
David

try this

Private Sub Command0_Click()
Dim StrCriteria as String
strCriteria = "Customer = " & Me!Text1
OpenReport "Models", acViewPreview, , strCriteria


End Sub


Good luck