Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004

    Unanswered: Newbie Query builder Question

    I had a question regarding Query builder i a form. Is it better to use the query builder or a query in a form? What I mean is, I looked at NorthWind and in that DB, it uses, Qrders Qry in the Orders form but when I looked into the Queries it is not listed.

    Sorry for the ignorance.

  2. #2
    Join Date
    Dec 2003
    I checked Northwind. The orders query is listed there. Try maximizing your database window or try scrolling the list of queries to look for it.

    The query builder allows you to build a new query from inside a form. It is basically the same as going to the queries tab in the database window and clicking on new or design to create or edit a query.

    The difference is that you aren't required to save the query in order to use it in the form. If you design a query outside the form (in the queries tab) you have to save it in order to call it from a form.

    Here are a few ways you can get data to a form:

    1. Create a query by going to the queries tab, creating a new query, saving the query and then setting the form's record source property to that query name.

    2. Create a form. Go to the record source property. Click on the query builder. Create your query. Close and return to the form. You can save this query if you wish. It will prompt you for a query name. It will then show up in the queries tab.

    3. Hand write the SQL statement from scratch. SQL is "An expression that defines a Structured Query Language (SQL) command, such as SELECT, UPDATE, or DELETE, and may include clauses such as WHERE and ORDER BY. SQL strings and statements are typically used in queries, Recordset objects, and aggregate functions but can also be used to create or modify a database structure." Tip: You can use the query designer to make your query and then switch to SQL view in the query designer where you can cut and paste the SQL for use in your forms, reports and Visual Basic procedures.

    4. Generate the SQL by Visual Basic on the fly. The best reason to do this is you can create custom SQL statements (in other words, non-saved, customized queries) based on the inputs and selections from users on the form. One popular reason to do this would be for a search query where the user enters the item(s) they wish to search for and you generate a query (SQL statement) to locate the records matching the search criteria.

    Hope this helps a bit.

    Joe G

  3. #3
    Join Date
    Sep 2004
    Thanks for the quick reply Joe,

    I just wanted to know if one was better than the other and I guess from your answer, it doesn't matter and there are four ways. The last one I did not know of,
    Thanks for the tip.

  4. #4
    Join Date
    Sep 2003
    Using the QBE is a good thing ... It helps build queries easier than having to do so by hand (let alone the validation). Now as for WHERE to run a query ... Making a "stored procedure" (and I use the term loosely) - Queries in the Query Section, is fine and dandy for single-user but when you start working in a multi-user environment those queries are a recipe for disaster (unless measures are taken). I generally do my queries in code (of course, I been doing this stuff for a long time too ...)
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts