Forms Record Source?

Y

YorkieU

I have a general question about a forms record source. I usually use the
build wizard within the forms properties to create the record source
essentially leaving it as a SQL statement. But I've notice in many example
DBs that a pre defined Query is used. Is there any difference? Is one method
better than another.
Thank you.
 
M

Mike Painter

I doubt you would see any real world differences and in general a predefined
query has several advantages.
1. The ability to use it in all relevant forms and reports without having to
build a new one each time.
2. It is easier to build and modify.
3. Knowing what the query does becasue you picked a descriptive name.
4. If any criteria are needed Forms!YourForm!YourField works well and you
can remove or modify it from the query builder if you find a STAR. (My
medical acronym that replaces a ton of them. A STAR is Something That Ain't
Right.)
 
D

Dirk Goldgar

YorkieU said:
I have a general question about a forms record source. I usually use the
build wizard within the forms properties to create the record source
essentially leaving it as a SQL statement. But I've notice in many example
DBs that a pre defined Query is used. Is there any difference? Is one
method better than another.


There's no real, practical difference. SQL statements that are specified as
recordsources and rowsources are still parsed and stored in the database as
hidden QueryDefs. If I have a query that I am going to use as the
recordsource or rowsource for more than one object, I will generally build
it as a stored query, and use that stored query. That saves storage and
enhances maintainability. But if the query is specific to only one object,
I'll generally just specify the SQL statement for the recordsource or
rowsource property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top