Topics Search

How to capture a user generated form filter

How to capture a user generated form filter
Views: 33
I'm trying to allow a user to drill down to a selection of records using the individual drop-down filters in the datasheet view of a split form, and from there make modifications to just the filtered records using VBA code.

and I can't figure out how to use code to save the manual filter choices. When I open and edit the recordset based on the form's recordsource query, it edits all the records in the query, not just the filtered set.

I think I need to save the filtered version of the query behind the form before I can work with just those records,
Sponsored Links:

Similar posts...


On No Data Event

On No Data Event Icon
Is there a Forms event similar to the On_No_Data event with reports? I have a small form that builds a filter for a recordset. If I run a DoCmd.OpenReport I can trigger No Data event when the filter finds no records. However, if I use a DoCmd.OpenForm with the same filter, a blank form displays. I would like to prevent the Form from displaying if no records are found by the filter. What is a good approach to capture the fact that no records meet the filter criteria?

Capturing Autonum on New Record Insertion

Capturing Autonum on New Record Insertion Icon
I'm looking for a method to capture the unique id for a row that is inserted into an Access table. I have a command button that I would like to do the following:

1) insert the fields in a form into the supporting table;
2) capture the autonum generated unique identifier in a field on the form;
3) have this data available to pass to a subform based on a table with a one to many relationship to the previous table.

Save current filter as query (realtime)

Save current filter as query (realtime) Icon
They are using a QBF (Query By Form) and then applying that filter. I then have a button on that form they can click that needs to print out only the reports of the records which fit the QBF.

1. When a user creates a QBF and clicks apply filter,


2. What is the name of the current filter? In otherwords, when a user creates a QBF and clicks apply filter, MSAccess is applying that filter which it has stored somewhere -- what is the code name of that filter? (eg. Me.CurrentFilter)


3. How can I allow a user to filter a form and then print the filtered list (not all of the records, not just one, but the ones that matched the filter).

Use subforms filter for chart record source

Use subforms filter for chart record source Icon
I have a sub form and related chart in 07. Can I capture the filter on the sub form and use it to filter the chart?

Possible to have single filter for a mix of blank and non blank criteria?

Possible to have single filter for a mix of blank and non blank criteria? Icon
Though there are lots of threads about multiple criteria.

Is it possible to have a SINGLE filter button that filters a form only by the filter criteria that the user specifies and not the possible criteria that the filter may have? That is, ifthere are multiple criteria that the user can filter by but she only chooses to specify, say, two out of five, and leaves the other three filter boxes blank, I want the filter to only pickup the ones she specified and NOT filter by Nulls in the other three fields.

I have 5 fields on which the user can filter by typing in what they want in text boxes. I don't want to have 5 separate filter buttons, I want just one that sets the filter on all the specified criteria.

Is it possible for the button to pick out only the criteria that the user specified? I mean, without having to go through ten thousand if statements like

If len(me.filterfield1)>0 and len(me.filterfield2)= 0 and. len(me.filterfield5)= 0 then
'set filter string to just the first criteria


.and so on.

Or is it better to just have a separate filter button for each text box?

Opening a form to a specific record

Opening a form to a specific record Icon
I have a button the user presses to save the record, close the form, and open up another form to the most recent record where theuser can enter in more detailed data about the record.

This approach works just fine in a single user input situation. However, if I have multiple users doing data input this causes some issues.

For Example:

User A assigns the records primary key (#1) with the first keystroke entered. User B begins to input, assigning a new primary key (#2) to the new record. User A finishes the basic input and presses the button saving the record and opening the second form for more detailed entry.

As the second form takes you last record enterend, the record displayed for user A has the primary key of #2.

This is not the record User A started with but is the record being prepared by User B.

Essentially, what I'm looking to do is, capture the value of the primary key close the first form and open the second form where the primary key is equal to the capture value.

How to: Use User Input to Build Filter Criteria

How to: Use User Input to Build Filter Criteria Icon
The BuildCriteria method enables you to easily construct criteria for a filter based on user input. It parses the expression argument in the same way that the expression would be parsed had it been entered in the query design grid, in Filter By Form or Server Filter By Form mode. Learn how to build criteria based on user input.

Using VB to turn the Toggle Filter Off

Using VB to turn the Toggle Filter Off Icon
I have a form called Customers that can be accessed from another form called Events. It might show an Event with the customers who are attached to that Event underneath. The user can then double click on the Customer to go directly to the Customers form.

This all works great. The problem is that once in the Customers form sometimes the user forgets that the form is filtered and it shows the one filtered record and not all 61 existing customers.

I have a filter or search box at the top of the Customers form that the user can click in and filter out a customer that way too.

here is the problem, the user then clicks the search drop down and tries to filter again. I have tried to program in the "on click" event in the search drop down. I have tried, FilterOn = False or ShowAllRecords.

This will not work to turn the Toggle Filter button off and show all the records.

Retrieve User Name and select Record based on such

Retrieve User Name and select Record based on such Icon
And I understand how to use this to track who has made changes to the Database.

However, is it possible to get Access to retrieve the User Name before it opens a Form so it can apply a Filter.

When a User opens a Form "Time Sheets", I would like Access open the Time Sheets form and to apply the Filter based on who is logged in. I Know there is a Filter and Filter on Load Propertyon the Data Tab, but if I add the GetNetUser () to this, it just opens the first Record on the list and applies a Filter to that (I created a Staff Record for "Brian", which is my UserAccount, yet it Filtered to the first Name in the Table--not mine)?

Filter to only view Current User's Records in a Microsoft Access form or query

Filter to only view Current User's Records in a Microsoft Access form or query Icon
There may be circumstances where you, as the database developer, may only wish to allow the current user of the Microsoft Access database to view only their own records. This can be achieved using various approaches and you will find one way of dealing with this shown below.
What we need to do to achieve this:
Create a module to capture the Current User accessing the Microsoft Access database.
Store the User Name to pass this to the Microsoft Access forms or queries.
Display information that relates to the Current User only.