Setting filter with a Macro

D

dcurtis

I am trying to set the following filter w/ a Macro using the SetValue
command and have been completely unsuccessful. The two arguments are as
follows:

[Form]![formname]!]Filter]
[Log_Number] Like "06*"

Basically I have a text field named Log_Number and it contains
numbers in the following format 12-345 where the first two numbers
are used to ref a year and the last three are simply sequential. I want
to be able to filter for a given year by setting a filter to show only
the records where the field starts with a certain value such as 06. I
have used this format with success in queries and can enter it manually
in the form filter property but when I try to apply it with the macro,
it puts a zero (0) in the property box.

Any suggestions are appreciated. I know that there would be a way to do
this with AccessVB but I am not a coder.

Thanks
 
V

Van T. Dinh

It has been a long time since I last used Macros but try the ApplyFilter
Macro action rather than SetValue.

If you still want to use the SetValue Macro action, I think you need to use
another SetValue Macro action to set the Property FilterOn to True to
actually apply the filter you set previously.
 
D

dcurtis

I do that as well, I set the Filter value property in the first line
and then the FilterOn value to true in the second line of the macro.
The problem is that the Filter value property sets to zero (0) in step
one. I see this since I have the properties dialog box open during my
testing and can see the change so when the FilterOn is set to True,
Access is unable to do anything with the Filter value.

For some reason that I do not understand, the SetValue action is not
putting the correct value into the Filter value property. I have tried
all sorts of syntax and it just won't do it. Don't know why.

Still looking for help. Thanks
 
D

dcurtis

Yes, but again, the Filter value is being set to zero (0) by the
previous action so applying the filter gives no results. It's setting
the filter value that I am having trouble with. i cna turn it on and
off without problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top