Filter By Selection

  • Thread starter Thread starter Dkline
  • Start date Start date
D

Dkline

I need to run a "Filter By Selection" and I cannot get the syntax right.

The SQL statement from the query is:

SELECT [tbl_manager value by policy].[Sub Manager Name], [tbl_manager value
by policy].PolicyNumber, [tbl_manager value by policy].[Client Name],
[tbl_manager value by policy].Program, [tbl_manager value by
policy].[SumOfFinal Balance]
FROM [tbl_manager value by policy]
WHERE ((([tbl_manager value by policy].[Sub Manager Name])="Greenbacks"));

That works just dandy.

What I need to do is have the current value of a combobox become the WHERE.

SO if the user then picks "Greenspan" I want to alter the Where to:
WHERE ((([tbl_manager value by policy].[Sub Manager Name])="Greenspan"))

I've tried this on the premise that I can build the string but this blows up
Me.Filter = ((([tbl_manager value by policy].[Sub Manager Name]) =
"Greenbacks"))

I get:
Run-time error '2465'
Microsoft Accesscan't find the file field 'l' referred to in your expression
 
If you are trying to apply a filter to the form's
recordsource based upon the value of yourComboBox, then try
DoCmd.ApplyFilter , "[Sub Manager Name]) = '" &
yourComboBox & "'"

Hope This Helps
Gerald Stanley MCSD
 
Thank you! Mission accomplished!

Gerald Stanley said:
If you are trying to apply a filter to the form's
recordsource based upon the value of yourComboBox, then try
DoCmd.ApplyFilter , "[Sub Manager Name]) = '" &
yourComboBox & "'"

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I need to run a "Filter By Selection" and I cannot get the syntax right.

The SQL statement from the query is:

SELECT [tbl_manager value by policy].[Sub Manager Name], [tbl_manager value
by policy].PolicyNumber, [tbl_manager value by policy].[Client Name],
[tbl_manager value by policy].Program, [tbl_manager value by
policy].[SumOfFinal Balance]
FROM [tbl_manager value by policy]
WHERE ((([tbl_manager value by policy].[Sub Manager Name])="Greenbacks"));

That works just dandy.

What I need to do is have the current value of a combobox become the WHERE.

SO if the user then picks "Greenspan" I want to alter the Where to:
WHERE ((([tbl_manager value by policy].[Sub Manager Name])="Greenspan"))

I've tried this on the premise that I can build the string but this blows up
Me.Filter = ((([tbl_manager value by policy].[Sub Manager Name]) =
"Greenbacks"))

I get:
Run-time error '2465'
Microsoft Accesscan't find the file field 'l' referred to in your expression


.
 
Back
Top