Record Source: "SELECT" vs Query (1 Viewer)

constableparks

Registered User.
Local time
Today, 04:12
Joined
Jul 6, 2017
Messages
53
I have a form and just wondering if there is any difference between setting the Record Source to "SELECT TblOven.* FROM TblOven;" versus a query that selects all fields from TblOven?

Is it essentially the same thing? If not, which is the preferred method?
 

missinglinq

AWF VIP
Local time
Today, 05:12
Joined
Jun 20, 2003
Messages
6,423
The SQL statement for the query would be the same, so I can't imagine any real advantage to using one over the other!

Linq ;0)>
 

constableparks

Registered User.
Local time
Today, 04:12
Joined
Jul 6, 2017
Messages
53
If I use a SQL statement rather than a query - I have fewer queries in my FE. I am not sure if that makes a difference, but my gut says fewer queries are better. But that may just be the voices in my head? :D
 

Mark_

Longboard on the internet
Local time
Today, 02:12
Joined
Sep 12, 2017
Messages
2,111
The advantage of specifying which records you wish in the form itself is you make sure that you get only those fields you need for that form without the chance someone would change the query on you.

The disadvantage is that you need to make sure you specify each and every portion of the SQL statement and you do not have a single repository where you can always recover this information from.

Using a query is far more effective if you have several areas that you want to make sure you deal with the same data sets. This is often the case if you have one form for data entry, another for validation, and a third for another purpose.

Simply asking for all fields also is less efficient if you are dealing with many records or large records. Asking for all fields when you are only using two is not the ideal way to do this.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:12
Joined
Feb 19, 2002
Messages
43,257
I normally use querydefs.
1. They're easier to test if they are separate from the form.
2. I can use the same exact query for a report.
3. There's a bug in Access that causes it to think the embedded SQL is a querydef name and chop off everything past the max size of a querydef object name. It doesn't happen often but if the query is big or complex it's a real bummer.

It takes a certain amount of discipline to consider that every change to a query affects every place it is used. Newer versions of Access have built in tool that shows both "uses" and "used by" so you can easily see what will be impacted by a change. Or, you can use Total Access Analyzer by FMS which is much more comprehensive.
 

bob fitz

AWF VIP
Local time
Today, 10:12
Joined
May 23, 2011
Messages
4,719
It takes a certain amount of discipline to consider that every change to a query affects every place it is used. Newer versions of Access have built in tool that shows both "uses" and "used by" so you can easily see what will be impacted by a change.
Where would I find it?
 

Users who are viewing this thread

Top Bottom