473,387 Members | 1,578 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,387 software developers and data experts.

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.OpenRecordset("Table1", 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 5000
Salad <oi*@vinegar.com> wrote in
news:W5******************@newsread1.news.pas.earth link.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.OpenRecordset("Table1",
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.com> wrote in
news:W5******************@newsread1.news.pas.earth link.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",,,strWhere
Set rst = Forms!Form1.Form.Recordsetclone
rst.findfirst "ID = " & Me.ID
Set Forms!Form1.form.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
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.OpenRecordset("Table1",
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
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...
3
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...
8
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...
2
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...
2
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...
5
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...
3
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...
3
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.