473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

If a form is filtered, does its recordset include the filter?

Seth Schrock
2,965 Expert 2GB
This might sound like a really dumb question. I have a form whose filter changes based on who is logged in (record access control). On this form, I have a textbox that allows me to type in a search number and pull up the record. Right now, I'm using the Me.Recordset.FindFirst method to find the record. Does this recordset include the form's filter? I need it to so that if the user can't go to that record (or the number typed in doesn't match a record) the .NoMatch method will trigger. So my question is, do I need to add my filter to the recordset criteria, or is that already done through the form's filter?
Jan 17 '13 #1

✓ answered by Stewart Ross

Assuming that you are setting the Filter property of the form in code after updating the textbox you mention, the form's recordset does indeed take the filter into account. The filter acts like having an additional WHERE clause on a SELECT statement.

-Stewart

9 2006
Stewart Ross
2,545 Expert Mod 2GB
Assuming that you are setting the Filter property of the form in code after updating the textbox you mention, the form's recordset does indeed take the filter into account. The filter acts like having an additional WHERE clause on a SELECT statement.

-Stewart
Jan 17 '13 #2
Seth Schrock
2,965 Expert 2GB
The form is filtered in the form's On_Load event. When the textbox uses the Me.Recordset, the form is already filtered.

That is the way that I thought it would, but I just wanted to make sure. Thanks Stewart.
Jan 17 '13 #3
NeoPa
32,556 Expert Mod 16PB
Am I wrong to think it would in all circumstances Stewart?

Normally (certainly in my projects) filtering is applied using the WhereCondition parameter of the DoCmd.OpenForm() call. I would expect the form's Recordset property to reflect that filter.
Jan 17 '13 #4
Stewart Ross
2,545 Expert Mod 2GB
Hi NeoPa. You are quite right that if the form's WhereCondition is set that too will change the recordset. I was unclear from what was posted by Seth how a filter was being applied, and misread it. I thought the filter was applied here:

@Seth: On this form, I have a textbox that allows me to type in a search number and pull up the record
But that is incorrect, as Seth stated in the first part of his post that the filter is by the user logged in, so hence on load.

I should have realised this and clarified that whatever filter or wherecondition is applied will be reflected in the recordset of the form.

-Stewart
Jan 18 '13 #5
TheSmileyCoder
2,322 Expert Mod 2GB
I would recommend that you do this filtering of records the user is not allowed to see, by the forms underlying query. I believe that would be safer. Whether the approach you have currently is sufficient, I don't know for sure, since I haven't really tried to brake it.

Make sure however, that you set the forms Allow Filters property to false, otherwise the user can simply remove the filter you applied through code.
Jan 18 '13 #6
Seth Schrock
2,965 Expert 2GB
I believe that I don't have to worry about the users removing the filter as they are using Access runtime and I have removed the navigation bar which has the filter on it. I believe this covers all my bases, but I could be wrong.

Anyway, I do have my answer about the filter being included in the Me.Recordset. Thanks everyone. I enjoy reading the discussions between experts as I learn much from it.
Jan 18 '13 #7
TheSmileyCoder
2,322 Expert Mod 2GB
I haven't used runtime, but I believe right clicking a enabled field will allow you to filter, provided you have not disabled the regular right click commandbars.

Either way, setting the AllowFilters property to false only affects manual filters as far as I know, this preventing the user from manually editing/adding/disabling the filter you set.
Jan 20 '13 #8
Seth Schrock
2,965 Expert 2GB
I had never played with right clicking on a text box, but you are right. There is an option to filter or clear the filter on that field. I will set the AllowFilters property to false. Thank-you for catching that.
Jan 20 '13 #9
TheSmileyCoder
2,322 Expert Mod 2GB
I remember someone in online forums who had a signature something like "There is ALWAYS more then 1 way to skin a cat".

I have always liked that saying especially for Access, cause I feel it fits so perfectly.
Jan 20 '13 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: edwards_zim via AccessMonster.com | last post by:
I have a dialog box where I specify the criteria I would like to filter. What I would like to do is use this information to then print forms using this filter information without the form actually...
1
by: Saintor | last post by:
I haven't been able to put it together yet. I wanted to use a CreateQueryDef based on the recordsetclone property. However the form is filtered and some fields are calculated Only a few...
2
by: Jim M | last post by:
I rarely deal with recordsets directly with code, since I usually use Access queries, so be patient with this question. I want to open a recordset with various default variables used by my program....
2
by: JonC | last post by:
I have a database where the user selects recordsets via a form with 2 levels of nested subforms. The recordsets are filtered using a series of linked combo boxes and I would like to be able to...
1
by: mattscho | last post by:
Re: Filter By From, Apply Filter, Remove Filter Buttons in a Form. -------------------------------------------------------------------------------- Hi All, Trying to create a set of 3 buttons in...
2
by: Andy Fish | last post by:
Hi, I am trying to investigate a problem reported by one of my users who received a "System.Web.HttpException: Request timed out." error trying to upload a large file into my asp.net 2.0...
2
by: Max2006 | last post by:
Hi, After I right-click on my web application project file and choose "Publish ." and do the publishing, the result publishable files does not include the *.ashx files. Is it by design? How...
3
by: jamesnkk | last post by:
Hi, I am new to vb6. I have some code written in the form load. the first time when I call the form, the code inside form load will activate. After I have complete the form and return to main...
9
dmjpro
by: dmjpro | last post by:
I am generating a HTML code through AJAX, and setting that HTML into a DIV and the DIV is inside a form. Now the form does not include an element which is being generated through AJAX. But whenever i...
7
by: DanicaDear | last post by:
I've tried to put together some code for a form. This code actually compiles (and I've very proud of that!) but it gives me this error when running and points to line 41 in the code below. "Run-time...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.