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

Query vs. Control Source (Which performs better?)

110 100+
I'm looking for any performance information/recommendation between basing a form on a query (or a Combobox) or just putting the SQL code directly in the control source of that form (or Row Source for combo boxes).

Does one perform faster than the other?
Is there a standard that should be followed?

I think I'm leaning toward doing away with queries and just including all SQL as the control source of that form. Aside from not being able to use the query for multiple forms, is there any downside to doing this?

Thanks in advance for any advice.

Best Regards -

Gunner
Sep 15 '13 #1

✓ answered by zmbd

dgunner71:

You have confused the issues here.
Control source is not the same as record source.
The two terms are NOT interchangable.

For the control source of any control on a form, you will be limited to either setting it to one of the fields of the form's record source or leaving it blank.

For a form, you may set this to a table, a stored query, or and embedded query. My choice depends on what I need to have happen; usually, I use a stored query. I will often embed the query in the record source of a form if I want to keep prying fingers from altering the query.

As for the combo/list box:
You need to understand the CombBox Object model.
ComboBox Object : ACC2010
Pay particular attention to the Control source, Rowsource, and bound column properties.

Once again; here for the rowsource, I often embed the query in the rowsource because I want to keep prying fingers from easily altering the query as I am often useing it as a bound lookup field; thus, the value returned absolutly has to be the correct entry for the field.

If you split the front and backends, I generally have the saved queries for the rowsource for the forms and controls in the frontend as these usually do not change; however these still need to access the backend tables to work so I don't think there's any performance gain.

3 1471
zmbd
5,501 Expert Mod 4TB
dgunner71:

You have confused the issues here.
Control source is not the same as record source.
The two terms are NOT interchangable.

For the control source of any control on a form, you will be limited to either setting it to one of the fields of the form's record source or leaving it blank.

For a form, you may set this to a table, a stored query, or and embedded query. My choice depends on what I need to have happen; usually, I use a stored query. I will often embed the query in the record source of a form if I want to keep prying fingers from altering the query.

As for the combo/list box:
You need to understand the CombBox Object model.
ComboBox Object : ACC2010
Pay particular attention to the Control source, Rowsource, and bound column properties.

Once again; here for the rowsource, I often embed the query in the rowsource because I want to keep prying fingers from easily altering the query as I am often useing it as a bound lookup field; thus, the value returned absolutly has to be the correct entry for the field.

If you split the front and backends, I generally have the saved queries for the rowsource for the forms and controls in the frontend as these usually do not change; however these still need to access the backend tables to work so I don't think there's any performance gain.
Sep 15 '13 #2
dgunner71
110 100+
zmbd -

Thanks for your reply - I understand the row source/record source clarification; thank you for pointing that out.

I believe you have answered my question -it does not sound as though there is an benefit to creating an 'query object' vs. 'embedding the SQL' as the record source.

My intention is, at least partly, exactly as you said - to keep prying fingers out of the queries. I was just concerned that there might be some performance loss (or gain) by doing so.

Thanks again!

Gunner
Sep 15 '13 #3
zmbd
5,501 Expert Mod 4TB
Always a pleasure.

Please keep track of this thread for a few days. Rabbit, Neopa, or one of the others may have a different view and bit better understanding as they program this stuff for a living; whereas, I program this as a secondary role in a lab.
Sep 15 '13 #4

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

Similar topics

6
by: Mark Lees | last post by:
I've created some fields that calculate future dates. The way they are set up they do not save to a table. This is the expression I used (=DateSerial(Year(),Month()+6,Day(). I placed it in the...
5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
1
by: Bart Lateur | last post by:
In an Access form, I'd like to show the status on whether an item as entered in a textbox (and thus in its coupled record field) exists in a list in another table. I've tried: - Making the...
2
by: Bob | last post by:
I've got a bound report with a query as the record source. I'm adding a total to the footer and have inserted a text box to display it. I'm attempting to set the control source of the text box to...
4
by: VivN | last post by:
I want to use an expression as the control source for a text box in a report (Access 2000). Whilst I have sucessfully used these simple ones =TimeToSingle(TotalHours(,))...
3
by: ChasW | last post by:
This should be most simple to do, and I am doing it elsewhere in the very same form, but for some reason it is not working in this case. My form uses a query as its Record Source. In the form...
7
by: Rolf Mander | last post by:
What performs better, theoreticaly? This <? echo date("d",time()); echo date("m",time()); echo date("Y",time()); ?> Or that? <? $time = time();
14
by: datasec23 | last post by:
Hi... I am working in MS Access 2000 and I have a field where depending on the values of other fields, I would like the field to return a particular word. Ideally, I would like the statement to...
4
by: colin spalding | last post by:
Access 2003 I posted this last week; unfortunately, none of the suggested solutions cured the problem I have a subform which lists financial transactions for a client in the main form, which...
4
by: Jimmy | last post by:
Hi, The other day, my boss corrected me to use "explicit qualification" instead of using "using directive". she asked me to use : "System.Data.DataSet ds = new System.Data.DataSet();" ...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.