I usually do this one of two ways.
1. Create an unbound textbox on a form and bind the query that supports the
report to that textbox via a WHERE clause in the query.
WHERE Forms!yourFormName.txt_Criteria IS NULL
OR [SomeField] = Forms!yourFormName.txt_Criteria
2. Create a function that I can pass values to, and use that function in
your where clause. I do this when I have the same report that I want to use
with multiple forms, and prefer this method over creating a global variable
for a couple of reasons. The first time you use this, you pass it a value
(you could put this line immediately before you call your Output method.
Call fnSomeValue(23)
after that, you can just use it in your query:
SELECT * FROM yourTable
WHERE [SomeField] = fnSomeValue()
Public Function fnSomeValue(Optional PassedVal As Variant = Null) As Variant
Static myVal As Variant
If Not IsNull(PassedVal) Then
myVal = PassedVal
ElseIf IsMissing(myVal) Or IsEmpty(myVal) Then
myVal = Null
End If
fnSomeValue = myVal
End Function
HTH
Dale
--
Don''t forget to rate the post if it was helpful!
email address is invalid
Please reply to newsgroup only.
dgeffs said:
I need to export a report in Access 2007 to a pdf file. I know this is
supported but how does one specify parameters for the report to export? There
is no where clause in the output to method and I want to export this without
actually opening the report.