473,769 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maxing out a filter string?

I have a log file with a list of records. The log file can be
unfiltered or filtered.

I have a command button to call a data entry form from the log. At
first I was only going to present the record the user selected. Then I
thought, what the heck, give the user all of them but start out at the
record the user is currently on.

If I pass the current filter that resides on the log this causes
problems. For example, if the filter is on Code = "D", the user can't
change the Code to "E" because that would not match the filter and it
would generate an "Update or CancelUpdate Without AddNew or Edit" error
message.

I wrote the following function. On my test it creates a filter string
of 12,000+ characters and the form didn't hickup on opening. Is the max
of a form filter string the max length of a string or is there a place
it bogs down?

Sub TestFormFilter
Dim s As String
Dim rst As Recordset
Set rst = CurrentDb.OpenR ecordset("Table 1", dbOpenSnapshot)
Do While Not rst.EOF
s = s & rst!ID & ","
rst.MoveNext
Loop
s = "ID IN (" & s & ")"
DoCmd.OpenForm "Form1", , , s
MsgBox "Done"
End Sub

Nov 12 '05 #1
2 5061
Salad <oi*@vinegar.co m> wrote in
news:W5******** **********@news read1.news.pas. earthlink.net:
I have a log file with a list of records. The log file can be
unfiltered or filtered.

I have a command button to call a data entry form from the
log. At first I was only going to present the record the user
selected. Then I thought, what the heck, give the user all of
them but start out at the record the user is currently on.

Consider opening the form with the primary key of the user
selected record as the openargs parameter of openform, and doing
a seek Cdbl(ID) in the data entry form's open event.

This approach would probably be much faster.

Bob Q.

If I pass the current filter that resides on the log this
causes problems. For example, if the filter is on Code = "D",
the user can't change the Code to "E" because that would not
match the filter and it would generate an "Update or
CancelUpdate Without AddNew or Edit" error message.

I wrote the following function. On my test it creates a
filter string of 12,000+ characters and the form didn't hickup
on opening. Is the max of a form filter string the max length
of a string or is there a place it bogs down?

Sub TestFormFilter
Dim s As String
Dim rst As Recordset
Set rst = CurrentDb.OpenR ecordset("Table 1",
dbOpenSnapshot) Do While Not rst.EOF
s = s & rst!ID & ","
rst.MoveNext
Loop
s = "ID IN (" & s & ")"
DoCmd.OpenForm "Form1", , , s
MsgBox "Done"
End Sub


Nov 12 '05 #2
Bob Quintal wrote:
Salad <oi*@vinegar.co m> wrote in
news:W5******** **********@news read1.news.pas. earthlink.net:

I have a log file with a list of records. The log file can be
unfiltered or filtered.

I have a command button to call a data entry form from the
log. At first I was only going to present the record the user
selected. Then I thought, what the heck, give the user all of
them but start out at the record the user is currently on.
Consider opening the form with the primary key of the user
selected record as the openargs parameter of openform, and doing
a seek Cdbl(ID) in the data entry form's open event.

This approach would probably be much faster.

Bob Q.


Hi Bob. Part of what you say is a thing I do. I open the form like this
Docmd.Openform "Form1",,,strWh ere
Set rst = Forms!Form1.For m.Recordsetclon e
rst.findfirst "ID = " & Me.ID
Set Forms!Form1.for m.bookmark = rst.bookmark... .

By passing the ID list, the filter will contain all records in the log
contained in a restrictive or non-restrictive filter.

I could set the single record's form filter to the log's filter.
However, if the log is filtered restrictively to "Code = 'C' And Amount 100" this creates a problem since I can't change the code or amount values since that would put the records outside of the filter and Access
echoes an error message if one attempts to change the code or amount
fields....at least in this instance that is what occurs.

If there is no filter on the log or a less restrictive filter is in
place, thousands of records could be passed in the filter string using
my function. I know that somewhere along the line, if I attempted to
use my function, the string length would max out the maximum permittable
size of a filter.

It's similar to attempting to stuff a SQL string over (I believe) 2048
characters into a recordsource... Access chokes. So I use a saved or
temp query for these instances.

I decided to limit the string to pass no more than 1000 ids. That way I
know the string is less than whatever limit exists and it is near
instantaneous.. .right now it displays instantaneously .

If I pass the current filter that resides on the log this
causes problems. For example, if the filter is on Code = "D",
the user can't change the Code to "E" because that would not
match the filter and it would generate an "Update or
CancelUpdat e Without AddNew or Edit" error message.

I wrote the following function. On my test it creates a
filter string of 12,000+ characters and the form didn't hickup
on opening. Is the max of a form filter string the max length
of a string or is there a place it bogs down?

Sub TestFormFilter
Dim s As String
Dim rst As Recordset
Set rst = CurrentDb.OpenR ecordset("Table 1",
dbOpenSnapshot) Do While Not rst.EOF
s = s & rst!ID & ","
rst.MoveNext
Loop
s = "ID IN (" & s & ")"
DoCmd.OpenForm "Form1", , , s
MsgBox "Done"
End Sub



Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
12240
by: Robin Cull | last post by:
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after them. What I want to do is filter out a subset of this dict to produce another dict that satisfies a set of criteria (in this case whether it contains all four values) to end up with something
3
6614
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where the text value is on a different table. The me.filter is then a text instead of the id-number from the lookup table. This causes the report to prompt for the parameter. How do I get by this problem? Do I need to create a temporary table? I rather...
8
6534
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and there are many examples. BUT, they fail sometimes. The techique is to pass the form's Me.filter as the "where condition" in a Docmd.openreport statement in code behind a "print button" on the form.
2
325
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the record the user selected. Then I thought, what the heck, give the user all of them but start out at the record the user is currently on. If I pass the current filter that resides on the log this causes problems. For example, if the filter is...
2
8844
by: Anandan | last post by:
Hi, In our Project we use Dataset to load the Grid with Values. We have some criteria to filter the values to be shown in the Grid. For that we used the SELECT command to filter the Same Dataset. The SELECT Command we are using is as follows DS.Tables(0).Select("FieldName = '" & input value & "')
5
2655
by: Ron S | last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at this... Exmaple web site: http://allenbrowne.com/ser-62.html My Code: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few criteria as they wish, _ and results...
3
2267
by: emgallagher | last post by:
I have a form which lists studies. People can filter the form based on details about the study, such as the study type. Currently users filter via the right click method. I would like to be able to have a report that shows just the filtered records. The code that I tried which didn't work:
3
1994
by: Mr 200 | last post by:
Hi all ive just recently started learning java and was happy to find a forum that may be able to give me a little assistance. I have been set an excersize to create a filter processor that relays information between several filters to give a result. I have created one of the filters already, however i need the filter processor working in order to test wether the filter i have done works correctly. However im not completely sure where to...
0
1336
by: DR | last post by:
Why is its substantialy slower to load 50GB of gzipped file (20GB gzipped file) then loading 50GB unzipped data? im using System.IO.Compression.GZipStream and its not maxing out the cpu while loading the gzip data! Im using the default buffer of the stream that i open on the 20GB gzipped file and pass it into the GZipStream ctor. then System.IO.Compression.GZipStream takes an hour! when just loading 50GB file of data takes a few minutes!
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.