Vicky said:
I have a button in my form that opens a report and that works, what i
would like to do now is open a specific report by the job number on
the form. Can this be done? if so how?
Look at the existing code behind your button. You will almost certainly
find that it is using the OpenReport method of the DoCmd object. That
method has an optional argument for supplying a WHERE clause which will
filter the report being opened. The string you can place in that argument
would have the same syntax as a valid WHERE clause in a query only without
the word "WHERE" at the beginning.
All you need to do is insert an expression there that will create a WHERE
clause that filters on the job number currenlty displayed on the form...
DoCmd.OpenReport "ReportName", acViewPreview,, "[job number] = " & Me![job
number]
The above assumes [job number] is a numeric field. If it is a text field
then you would need quotes around the value like this...
DoCmd.OpenReport "ReportName", acViewPreview,, "[job number] = '" & Me![job
number] & "'"