producing a report based on filter criteria...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

I have a form which displays detail records from a query which is pulling
three tables together. I am giving the user the ability to 'filter by form'.
After they have filtered, they want to be able to print the currently
filtered recordset. I assumed I could use the value in the 'filter' property
after the filter has been applied. I would then call a function passing the
'filter' value as a 'where' clause to print the report. However, it always
fails, and when I look at the 'filter' value, it includes some bizarre
values in there that obviously will not work. An example is as follows....
((Lookup_fname.FName="Stemple")). Where is the "Lookup_fname" coming from?
If I send this to a where clause it fails every time. If there was no
"lookup_fname" in there and it simply said fname = "Stemple" we'd be good.
How can one produce a report that is based on the currently filtered
recordset of a form?

Thanks,

Brad
 
Remove the "Lookup_fname" from the filter property prior to using the form's
filter as the where clause.
Dim strWhere as String
strWhere = Mid([Filter], Instr([Filter],".") + 1)
DoCmd.OpenReport .....,strWhere
This may become more complex if you have a more complex filter value.
 
Thanks Duane. It looks like this is what I will ahve to do. What string
function can I use to search for a value inside a string and replace it with
nothing (i.e.. remove the value I am looking for)

Thanks,

Brad
Duane Hookom said:
Remove the "Lookup_fname" from the filter property prior to using the form's
filter as the where clause.
Dim strWhere as String
strWhere = Mid([Filter], Instr([Filter],".") + 1)
DoCmd.OpenReport .....,strWhere
This may become more complex if you have a more complex filter value.

--
Duane Hookom
MS Access MVP
--

Brad Pears said:
I have a form which displays detail records from a query which is pulling
three tables together. I am giving the user the ability to 'filter by form'.
After they have filtered, they want to be able to print the currently
filtered recordset. I assumed I could use the value in the 'filter' property
after the filter has been applied. I would then call a function passing the
'filter' value as a 'where' clause to print the report. However, it always
fails, and when I look at the 'filter' value, it includes some bizarre
values in there that obviously will not work. An example is as follows....
((Lookup_fname.FName="Stemple")). Where is the "Lookup_fname" coming from?
If I send this to a where clause it fails every time. If there was no
"lookup_fname" in there and it simply said fname = "Stemple" we'd be good.
How can one produce a report that is based on the currently filtered
recordset of a form?

Thanks,

Brad
 
Use either what I have already suggested, Replace(), or roll your own
function.

--
Duane Hookom
MS Access MVP
--

Brad Pears said:
Thanks Duane. It looks like this is what I will ahve to do. What string
function can I use to search for a value inside a string and replace it with
nothing (i.e.. remove the value I am looking for)

Thanks,

Brad
Duane Hookom said:
Remove the "Lookup_fname" from the filter property prior to using the form's
filter as the where clause.
Dim strWhere as String
strWhere = Mid([Filter], Instr([Filter],".") + 1)
DoCmd.OpenReport .....,strWhere
This may become more complex if you have a more complex filter value.

--
Duane Hookom
MS Access MVP
--

Brad Pears said:
I have a form which displays detail records from a query which is pulling
three tables together. I am giving the user the ability to 'filter by form'.
After they have filtered, they want to be able to print the currently
filtered recordset. I assumed I could use the value in the 'filter' property
after the filter has been applied. I would then call a function
passing
the
'filter' value as a 'where' clause to print the report. However, it always
fails, and when I look at the 'filter' value, it includes some bizarre
values in there that obviously will not work. An example is as follows....
((Lookup_fname.FName="Stemple")). Where is the "Lookup_fname" coming from?
If I send this to a where clause it fails every time. If there was no
"lookup_fname" in there and it simply said fname = "Stemple" we'd be good.
How can one produce a report that is based on the currently filtered
recordset of a form?

Thanks,

Brad
 
Back
Top