That should probably be
Title Like "*Roc*"
That assumes that the report has a field named Title in its record source.
The "frmBookListing" part refers to the FORM which the report's record source
would have no idea about.
If the filter string is never more complex than this example you could try
parsing the filter to remove the reference to the subformName
stWhere = Forms![frmlibraryMenu]![frmBookListing].Form.Filter
stWhere = Mid(stWhere,Instr(1,stWhere,"].")+2)
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
On 1/19/2011 4:34 PM, vvariety wrote:
> On Jan 19, 2:28 pm, John Spencer<JSPEN...@Hilltop.umbc> wrote:
>> StWhere should be a string that contains the name of a field, an operator, and
>> a value to be searched for.
>>
>> Try debug print and see if you get something like the following returned.
>> Debug.Print stWhere
>>
>> In the VBA immediate window you should see the string that is in stWhere
>>
>> MyField Like "*Gold*"
>> where myField is the name of a field in the report.
>>
>> John Spencer
>> Access MVP 2002-2005, 2007-2010
>> The Hilltop Institute
>> University of Maryland Baltimore County
>>
>> On 1/19/2011 10:42 AM, vvariety wrote:
>>
>>
>>
>>> I have been trying to filter a report based on the results of a filter
>>> on a form. The print button on the form has the following code:
>>
>>> Dim stWhere As String
>>
>>> stWhere = Forms![frmlibraryMenu]![frmBookListing].Form.Filter
>>
>>> DoCmd.OpenReport "rptbooklisting", acViewPreview, stWhere
>>
>>> Issue: If there is no filter then the report previews all 1500+ pages
>>> fine if the form is filtered then the report comes up blank with an
>>> error msg. SubformName.fieldName "*Gold*"
>>
>>> Can't figure out what I am doing wrong any help would greatly be
>>> appreciated.- Hide quoted text -
>>
>> - Show quoted text -
>
> The results of the debug window is
> debug.Print stwhere
> ([frmBookListing].[Title] Like "*Roc*")
|