Populate forms

  • Thread starter Thread starter Adrian Roberts
  • Start date Start date
A

Adrian Roberts

Hi
I have been told in a previous answer that to achieve what I want I could
use the filter by form button. That works, but now is there a way i can do
this from the form as I would like to turn off the toolbars. Other people
would be using the DB and they dont know about using the filters.

I think I need to start the routine / then apply the filter / then clear the
search grid.

Is it possible..

Thanks
Ady
 
Hi.

If you right-click on the Form, is there a "Filter By Form" item in the
popup menu?

-Michael
 
Thanks,
Your right there is, I'm starting to feel a pillock.
But that still requires people to know how to go about using it.I wont
always be there to help. It would be great if it was just me using it, I
guess I just want to make it easy for others, I felt that a simple button on
the form allowing them to enter the search criteria and then populate the
same form with the results, I can add all my report buttons to the form no
problem and people can use them ok.

In the form design view I can add a command button that is listed as "apply
form filter" is there anyway I can utilise it and maybe the other functions
such as clear search grid and get the form into form filter mode..

Sorry for being such a pain.

Or, am I looking a pile of coding..

Thanks so much
Ady
 
I can get the gist of the meaning from the context, but what exactly is a
pillock?

You're correct, right-clicking in order to perform filter operations will
not necessarily be intuitive to your users, so I understand why you'd prefer
to use buttons. However, as soon as you switch to "Filter By Form" mode, all
command buttons are disabled. This means that the only way to apply the
filter would be to right-click and choose that option from the popup menu.
You could, of course, create your own custom filter form, but this would
require more than a little VBA coding.

If you only need to filter on a single field on the form, you could add a
TextBox or ComboBox in which the user can specify filter criteria, then add a
single button to Enable/Disable the filter. The button's Click event would
look something like this:
Private Sub cmdFilter_Click()
If Me.cmdFilter.Caption = "Apply Filter" Then
Me.cmdFilter.Caption = "Remove Filter"
Me.Filter = "[FieldName] = " & Chr(34) & Me.ComboBoxName & Chr(34)
Me.FilterOn = True
Else
Me.cmdFilter.Caption = "Apply Filter"
Me.Filter = ""
Me.FilterOn = False
End If
End Sub

The above assumes the filter criteria is a string. If not, remove both
instances of "& Chr(34)". Also, make sure that the button's Caption property
is initially set to "Apply Filter".

Another alternative is to provide a "Filter Help" button that, when clicked,
will display an informative message to the user on how to use Filter By Form.

Still another alternative is to create a custom toolbar containing only the
filter-related options, and to show that toolbar when the form is open.

-Michael
 

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

Back
Top