473,387 Members | 1,585 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.

Simple workaround to slow Find or unusable Seek on attached tables!

When I migrated my tables to SQL Server I needed a way to overcome the
slow performance of the Find method on my recordsets. Although this
can be done by accessing the table directly using dao and odbc, or by
using a parameter query that's customized in code for each search, I
was able to find a simple and fast solution based on the same native
Access SELECT query I used previously with native Access tables.

In my example I open an invoice editor form based on my Access select
query.

I added the following criteria to the InvoiceNumber column in the
design view of my query:

IIf(IsNull([Forms]![Enter/Edit
Invoices]![txtInvoiceToFind]),[Invoices].[InvoiceNumber],[Forms]![Enter/Edit
Invoices]![txtInvoiceToFind])

For readability and comments:

IIf(IsNull([Forms]![Enter/Edit Invoices]![txtInvoiceToFind]),
<THEN> [Invoices].[InvoiceNumber], <return all invoices>
<ELSE> [Forms]![Enter/Edit Invoices]![txtInvoiceToFind]) <selected
invoice>

I have a criteria field and two command buttons, BEGIN SEARCH and
CLEAR SEARCH, in one corner of the form.

When the form opens, the search criteria is null by default so the
query loads all invoices (thousands, fairly quickly) into the
recordset, and the first record appears in the form.

When I enter an invoice number in the search criteria textbox on the
form and click BEGIN SEARCH, the cmdBeginSearch onclick event
requeries the form (me.requery) and returns only the invoice sought.
At this point, I can edit the invoice. Note that the datasheet view
will reveal that only this invoice is
available in the recordset.

When I click CLEAR SEARCH its onclick event sets the search criteria
field to null and requeries the form, once again returning all
invoices to the recordset.

Hope this helps someone. It saved me a headache trying to balance my
native query with direct access to the tables.

Bob
Nov 13 '05 #1
3 1885
"Bob C." <bc******@bmghomes.com> wrote in message
news:2e*************************@posting.google.co m...
When I migrated my tables to SQL Server I needed a way to overcome the
slow performance of the Find method on my recordsets. Although this
can be done by accessing the table directly using dao and odbc, or by
using a parameter query that's customized in code for each search, I
was able to find a simple and fast solution based on the same native
Access SELECT query I used previously with native Access tables.

In my example I open an invoice editor form based on my Access select
query.

I added the following criteria to the InvoiceNumber column in the
design view of my query:

IIf(IsNull([Forms]![Enter/Edit
Invoices]![txtInvoiceToFind]),[Invoices].[InvoiceNumber],[Forms]![Enter/Edi
t Invoices]![txtInvoiceToFind])

For readability and comments:

IIf(IsNull([Forms]![Enter/Edit Invoices]![txtInvoiceToFind]),
<THEN> [Invoices].[InvoiceNumber], <return all invoices>
<ELSE> [Forms]![Enter/Edit Invoices]![txtInvoiceToFind]) <selected
invoice>

I have a criteria field and two command buttons, BEGIN SEARCH and
CLEAR SEARCH, in one corner of the form.

When the form opens, the search criteria is null by default so the
query loads all invoices (thousands, fairly quickly) into the
recordset, and the first record appears in the form.

When I enter an invoice number in the search criteria textbox on the
form and click BEGIN SEARCH, the cmdBeginSearch onclick event
requeries the form (me.requery) and returns only the invoice sought.
At this point, I can edit the invoice. Note that the datasheet view
will reveal that only this invoice is
available in the recordset.

When I click CLEAR SEARCH its onclick event sets the search criteria
field to null and requeries the form, once again returning all
invoices to the recordset.

Hope this helps someone. It saved me a headache trying to balance my
native query with direct access to the tables.

Bob


My only comment would be "Why load all of them in the first place (or
ever)?". You're pulling all records over the network knowing full well
that the user will only ever ask for one of them at a time. I wouldn't
pull ANY records over until the user asked for the one they want.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Your comments are fair and good.

Thank you for sharing that with us.

The basic rule here is (as you show) is to ALWAYS ask the user what they
want, and THEN load the form.

There is NO reason to load up a form without first having ask the user what
they want.

strInvoice = inputbox("what invoice to edit")

docmd.OpenForm "frmCustomerInvoice",,,"invoiceid = " & strInvoice

The above is all you need, and restricts the form to the ONE record.

A good design will thus NEVER load a up a form that is simply attached to a
table. So, even without sql server, I find tables with 50,000 records, and
about 5 to 10 users on a office network respond absolute instant. (remember,
reducing the number of records to a form also works when you DO NOT use sql
server). So, your tip does not only apply to sql server here!

I also outline a nice search concept here:

http://www.attcanada.net/~kallal.msn/Search/index.html
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #3
Thanks for your comments, guys.

My error may have been in not posting the following footnote with my
solution:

My example was a simplification of the actual app. In practice, my
app accepts both vendor and invoice criteria for the search. The
recordset initially loads records for a single vendor, giving the user
the ability to switch to the datasheet view of the form and see all
the invoices for a single vendor, a relatively very small set. The
datasheet view is used so often that this approach is good enough for
now.

As the title of my first post may suggest, I needed to quickly provide
a way to replace the FIND method in the search code, and save the user
time in retrieving a single invoice. (I haven't even mentioned the
subform containing the itemized detail for each invoice.) My solution
worked (with no noticeable impact on network traffic), and the users
are happy. Now I can go back and make it efficient, as you correctly
describe in your replies.

Thanks again. All the best,

Bob C.
Nov 13 '05 #4

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

Similar topics

4
by: DBNovice | last post by:
I have a database that keeps records on the issue and failure of an item. Currently, the database is poorly desisned; therefore I'm performing queries to break the data into normalized tables and...
4
by: serge | last post by:
I tried all the INFORMATION_SCHEMA on SQL 2000 and I see that the system tables hold pretty much everything I am interested in: Objects names (columns, functions, stored procedures, ...) stored...
3
by: Arno R | last post by:
Hi all, Starting from Access 2k we can use tables and queries directly in the Subform control as a SourceObject. The Subform-Sourceobject can be assigned when a query or table has been chosen from...
1
by: Brian Henry | last post by:
I know some of you have seen this problem. Stepping through code in the debugger is slow as heck in Visual Studio 2005. Well here is the problem, Edit and continue. Because edit and continue does...
4
by: T.S.Negi | last post by:
Hello All, I want to Find out list of tables, views and stored procedure used in vb form. If any body have any idea about it, pls.let me know. Thanx in adv. T.S.Negi
2
by: Rune Froysa | last post by:
I have one table with columns that are used as foreign-keys from several other tables. Sometimes deletion from this table takes +5 seconds for a single row. Are there any utilities that can be...
2
by: meru | last post by:
Hi, I have the following query which is running very slow SELECT D.STORE_FACILITY_ID,D.PRIMARY_ACCT_NUM FROM DS_STORE D WHERE D.PRIMARY_ACCT_NUM IN(SELECT W.COMPONENT1_ID FROM WK_FILTER_CMPNT...
1
rizwan6feb
by: rizwan6feb | last post by:
I am developing an application in VB.net 2005 that synchronizes two mysql databases of same structure. I have done most of the work but having problem in finding the difference in records in 2...
4
dlite922
by: dlite922 | last post by:
Short Version How do you find the difference between two database with the same structure but different data? with SQL (results will be ingested with PHP). Long Version Seems like a little...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.