A method I've used in the past.
In the load Event of the report First check to be sure that the Form is loaded.
Code:
If not isformopen("yourformname") Then
MsgBox "The Form Your Form Name is not open please open the form and re-run the report",vbokonly,"Missing Form Error"
cancel = true
Else
If isnull(forms!yourformname!criteriafield) Then
me.recordsouce = "Query1"
Else
me.recordsource = "query2"
End if
End if
In a module unclude the following function.
Code:
Function isformopen(strfname as string) as integer
'This function returns true if a form is open:
'This function from the Access 2007 Bible
dim i as integer
'Assume False;
isformopen = false
For i = 0 to forms.count -1
If Forms(i).name = strfname Then
isformopen = true
exit function
end if
next
End function