Minor Query issue - Opening Query from Two Forms

mcgilla

Registered User.
Local time
Today, 04:51
Joined
Sep 17, 2010
Messages
31
Hello,

to save space, I want to open a report based on a query from two different forms. In the query it's easy enough to do and it does work, however, when I open the report from the second location, I'm asked for the information from the first location. Basically we'll say the report is based on a "Part Number". Is there any way to supress the prompt in the second location?

The reason I'm asking is, to avoid this, as not everyone is computer savvy in the organization, I've duplicated queries and reports to avoid the prompt. And in the development I'm now doing, it sure would be nice to just have one query and one report but be able to select the criteria from several locations. This need/desire is going to be more so as I continue since multiple people are using the database in different ways. My front end is already 17mb and I could possibly trim that a bit by going back and reducing the number of duplicate queries and reports if I can only supress the prompts.

As it stands, the one particular instance I'm asking for, while currently in two locations, will be needed in four locations in the database.

Like I said, a simple issue, I just need to supress the prompt of information for the 2nd, 3rd and 4th locations.

Thanks,
Ed
 
Try this Function I haver also included other criteria. The key is CodeContextObject

Code:
Function Artists_Reports()

    With CodeContextObject
        If IsNumeric(.[Artist Code]) And ArtistsStockNo > 0 Then
            If .[Page No] = 0 Then
                DoCmd.OpenReport "Originals Report", acViewPreview, "", "[Orig Artist Ref]='" & .[Artist] & "' And [Orig Stock Status]='C' And [Status Flag]='A'", acWindowNormal
            ElseIf .[Page No] = 1 Then
                DoCmd.OpenReport "Prints Report", acViewPreview, "", "[Print Artist Ref]='" & .[Artist] & "' And [Print Detail Stock Status]='C' And [Status Flag]='A'", acWindowNormal
            ElseIf .[Page No] = 4 Then
                DoCmd.OpenReport "Originals Report", acViewPreview, "", "[Orig Artist Ref]='" & .[Artist] & "' And [Orig Stock Status]='H'", acWindowNormal
            ElseIf .[Page No] = 5 Then
                DoCmd.OpenReport "Prints Report List", acViewPreview, "", "[Print Artist Ref]='" & .[Artist] & "' And [Print Active]=No", acWindowNormal
            End If
        End If
    End With
End Function

Simon
 

Users who are viewing this thread

Back
Top Bottom