By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Trying to set form filter from module

P: n/a
Hello there!

I have a piece of code in a module (function) that constructs a
filter.
But now I run into a problem.....

It seems that I can only set a filter form a module if I open the form
in design mode..............
(that is, if changing the filter from a module / called function)
But that means any other changes I made on the form (such as f..e. the
rowsource of several comboboxes) will be
undone........................
Is my conclusion right?

TIA Henro

Mar 8 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Henrootje wrote:
Hello there!

I have a piece of code in a module (function) that constructs a
filter.
But now I run into a problem.....

It seems that I can only set a filter form a module if I open the form
in design mode..............
(that is, if changing the filter from a module / called function)
But that means any other changes I made on the form (such as f..e. the
rowsource of several comboboxes) will be
undone........................
Is my conclusion right?

TIA Henro
Me.Filter = "ID = 1"
Me.FilterOn = True

If referring from elsewhere
Forms!Form1.Form.Filter = "ID = 1"
Forms!Form1.Form.FilterOn = True

Or
strFilter = "Select * From Table1 Where ID = 1"
Me.Recorsource = strSQL

Mar 8 '07 #2

P: n/a
On 8 mrt, 17:09, salad <o...@vinegar.comwrote:
Henrootje wrote:
Hello there!
I have a piece of code in a module (function) that constructs a
filter.
But now I run into a problem.....
It seems that I can only set a filter form a module if I open the form
in design mode..............
(that is, if changing the filter from a module / called function)
But that means any other changes I made on the form (such as f..e. the
rowsource of several comboboxes) will be
undone........................
Is my conclusion right?
The referring from elsewhere just did not want to work. But I put the
code in a sub on the foprm itseld and now call that sub whenever
needed. Works like a charm!
>
Me.Filter = "ID = 1"
Me.FilterOn = True

If referring from elsewhere
Forms!Form1.Form.Filter = "ID = 1"
Forms!Form1.Form.FilterOn = True

Or
strFilter = "Select * From Table1 Where ID = 1"
Me.Recorsource = strSQL- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

Mar 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.