473,772 Members | 3,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

As a generale rule - Query or VBA?

I seem to end up with loads of append and update queries just because it's
quick and easy to build queries or make a new ones based on an existing
query. But I end up with loads of queries with long names like:

qryfrmCustomers _Diary_DeleteEn triesBeforeADat e
qryfrmMaintenan ce_CloneOrder_S tep1_CreateOrde rIDAndDescripti on

Am I being lazy? Should I code most of my action queries to tidy up the
clutter in the database window?

Is there a general rule for this?

Thanks,

Paul
Aug 11 '06 #1
30 2342
if they're action queries I won't use elsewhere, I just use

DBEngine(0)(0). Execute "SQL Statement...", dbFailOnError

Aug 11 '06 #2
I think a good portion of Access people do what you do, however it is
better to write and execute the SQL in code when possible. It reduces
clutter, but it makes it more difficult for lesser-experienced people
to debug issues.

Paul H wrote:
I seem to end up with loads of append and update queries just because it's
quick and easy to build queries or make a new ones based on an existing
query. But I end up with loads of queries with long names like:

qryfrmCustomers _Diary_DeleteEn triesBeforeADat e
qryfrmMaintenan ce_CloneOrder_S tep1_CreateOrde rIDAndDescripti on

Am I being lazy? Should I code most of my action queries to tidy up the
clutter in the database window?

Is there a general rule for this?

Thanks,

Paul
Aug 11 '06 #3
Prepared queries are more efficient than executing SQL prepared on the fly.

The problem is that as you say the d window gets cluttered up, I suspect
most people with experience use a mixture of methods.
--

Terry Kreft
"Paul H" <no****@nospam. comwrote in message
news:G6******** ************@ec lipse.net.uk...
I seem to end up with loads of append and update queries just because
it's
quick and easy to build queries or make a new ones based on an existing
query. But I end up with loads of queries with long names like:

qryfrmCustomers _Diary_DeleteEn triesBeforeADat e
qryfrmMaintenan ce_CloneOrder_S tep1_CreateOrde rIDAndDescripti on

Am I being lazy? Should I code most of my action queries to tidy up the
clutter in the database window?

Is there a general rule for this?

Thanks,

Paul


Aug 11 '06 #4
-->Should I code most of my action queries to tidy up the
clutter in the database window?

My answer is no. Instead, name them USYS_del_Entrie s_Before_a_date .

If your only intention is to declutter the database window, then this
method will hide them, only visible if you turn on system objects. If
the query is saved, then JET will save the fastest execution path. If
its in code, the JET engine first has to ensure it is valid SQL, then
determine the execution path, then execute it. Which sounds faster?

Granted, for smaller tables, it might not make a noticeable difference.
But, for scalability concerns, it is much easier to use queries and
then move them to SQL Server instead of code. Using code will not
achieve any performance gains with SQL then with Access.

I'm trying to declutter my code using procedures. The database window
is not a concern for me, especially with the Object Dependencies tool
now. I'd hate to think I tried cleaning up the database window and
deleted a query that some code required.

Chris Nebinger


Paul H wrote:
I seem to end up with loads of append and update queries just because it's
quick and easy to build queries or make a new ones based on an existing
query. But I end up with loads of queries with long names like:

qryfrmCustomers _Diary_DeleteEn triesBeforeADat e
qryfrmMaintenan ce_CloneOrder_S tep1_CreateOrde rIDAndDescripti on

Am I being lazy? Should I code most of my action queries to tidy up the
clutter in the database window?

Is there a general rule for this?

Thanks,

Paul
Aug 11 '06 #5
ch************@ gmail.com wrote:
-->Should I code most of my action queries to tidy up the
clutter in the database window?

My answer is no. Instead, name them USYS_del_Entrie s_Before_a_date .

If your only intention is to declutter the database window, then this
method will hide them, only visible if you turn on system objects. If
the query is saved, then JET will save the fastest execution path. If
its in code, the JET engine first has to ensure it is valid SQL, then
determine the execution path, then execute it. Which sounds faster?
[snip]

I completely disagree. The speed difference is neglible and the
self-documenting nature of SQL executed in code is a HUGE advantage over a
stored query def. When looking at that query months later you will have to
search to find out where it is called (if at all), then research some more
to determine if a change will break some other part of the app that you
didn't remember also used the same query. SQL executed in code is self
explanatory and has an obvious scope.

I use saved querydefs only when I have to.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Aug 11 '06 #6
rkc
ch************@ gmail.com wrote:
-->Should I code most of my action queries to tidy up the
clutter in the database window?

My answer is no. Instead, name them USYS_del_Entrie s_Before_a_date .

If your only intention is to declutter the database window, then this
method will hide them, only visible if you turn on system objects.
You can also hide a query by right clicking it, selecting properties and
checking attributes: Hidden. Hidden Objects has to be not selected in
Tools, Options, View, Show.
Aug 11 '06 #7
"Paul H" <no****@nospam. comwrote in
news:G6******** ************@ec lipse.net.uk:
I seem to end up with loads of append and update queries just
because it's quick and easy to build queries or make a new ones
based on an existing query.
I store few action queries, but lots of SELECT queries.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 11 '06 #8
"Terry Kreft" <te*********@mp s.co.ukwrote in
news:Dc******** ************@ka roo.co.uk:
Prepared queries are more efficient than executing SQL prepared on
the fly.
Is that really a significant issue in most cases? I have never seen
any real performance drain from using DAO for things.

Does it really take that long to optimize SQL?

Keep in mind also that if you're sending the SQL to a back-end
server database, those often will optimize and cache the temporary
query, as long as the SQL remains the same (dunno if they can do it
with queries that differ only in the values in the WHERE clause).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 11 '06 #9
rkc <rk*@rochester. yabba.dabba.do. rr.bombwrote in
news:%l******** ***********@twi ster.nyroc.rr.c om:
You can also hide a query by right clicking it, selecting
properties and checking attributes: Hidden.
Doesn't every developer work with all system and hidden objects
showing?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 11 '06 #10

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

Similar topics

5
7130
by: Terry Coccoli | last post by:
We have a Siebel implementation and for one query that was taking a long time to run I asked a DBA to evaluate the explain plan. I noticed that he chose to evaluate the Rule based optimization. I asked him why and he said that the Siebel application defaults to Rule based optimization. Not that I don't trust him, but I had the impression that Cost based was the way to go. Is it possible to set up a database schema so that it the...
0
3149
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too much data for field' or the query just runs on and on til I have to restart the postmaster. I have found rules to compare mine to but people limit the resulting insert to one record (the WHERE generally limits the result of the SELECT to one...
6
2577
by: Chris Travers | last post by:
Hi all; I am using PostgreSQL 7.4 on RedHat 9, though I don't think that is important to this problem. I am attempting to write a rule that will check to see whether certain conditions are right for a SELECT query and abort the query of those connections are not right. In this case, I am trying to do additional permissions enforcement. I have written a function to do the checking, but when I create the rule, I get an error. So here...
4
5486
by: Chris Kratz | last post by:
Hello all, We have run into what appears to be a problem with rules and subselects in postgres 7.4.1. We have boiled it down to the following test case. If anyone has any thoughts as to why this would be happening, we would appreciate feedback. We have tested on 7.3.4, 7.3.6 and 7.4.1 and all exhibit the same behavior. Test case one tries to populate table2 from table1 with records that are not in table2 already. Table2 gets...
8
6526
by: markjerz | last post by:
Hi, I basically have two tables with the same structure. One is an archive of the other (backup). I want to essentially insert the data in to the other. I use: INSERT INTO table ( column, column .... ) SELECT * FROM table2
1
6233
by: Vinod Sadanandan | last post by:
A Roadmap To Query Tuning ============================ For each SQL statement, there are different approaches that could be used to retrieve the required data. Optimization is the process of choosing the most efficient way to retrieve this data based upon the evaluation of a number of different criteria. The CBO bases optimization choices on pre-gathered table and index statistics while the RBO makes it's decisions based on a set of ...
1
1172
by: spanky1968 | last post by:
Hello, I'm sure there is someone here way smarter than me. I need help with a big to me query. I would like to perform a query that gets the information I need and then join a count of some more information to the end of the output. (I know clear as mud) Here's what I have so far, select a.rule, b.account, count(*) from Table1 a, Table2 b, Table3 c where c.rule = a.rule and a.month = DEC and a.rule > 0 and b.account_type != '*' group...
1
2086
by: MLH | last post by:
Anyone remember if A97 append query failure would ever report data breaking validation rule when such was not the case. I have an old SQL statement - several years old now. I've encountered a case in which the append fails and the reported error is validation rule. The table being appended to (tblClusters) has only 1 field with a validation rule: , with Byte Field Size property setting. The validation rule is >0. The field's default...
0
9619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
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...
1
10038
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
9911
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
8934
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
7460
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...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
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
2850
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.