INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Queries

How do I use SQL to create a query? by johnnymac43
Posted: 11 Mar 03


If you ask how to do something in Access, a response will often include an SQL statement for a query. This can be daunting for new users, but it need not be.

Often, when someone decides to offer a response to a question, they will build tables and queries in a test database, using the information provided in the question. When they have a working solution they will copy the SQL generated by Access and paste it into their reply. At other times they may use an SQL statement from one of their own applications as an example, in which case the table and field names may be different to those used by the questioner.

In either case, the way to make use of the SQL is as follows:

> Copy the SQL from the reply into a text editor.

> Identify the table names and field names in the SQL and make them identical to those in your database.

> Copy the modified SQL to the clipboard.

NOTE: The following steps are based on Access 2000.

> Open your database, select 'Queries' and double click on 'Create query in Design view'. The query design window will open, titled 'Query1 : Select Query', and the 'Show Table' dialogue box will open and be given the focus.

> Close the 'Show Table' dialogue box. The query design button bar will be displayed and the 'View' button will show 'SQL'.

> Click on the 'SQL' button in the button bar. A window will open containing the highlighted text 'SELECT;'.

> Click on the 'Paste' button in the button bar. The SQL from the clipboard will overwrite the previous text, and the 'View' button will change to the datasheet icon.

> Click on the down arrow beside the 'View' button and select 'Design View'. The query design window will show all elements of the query.

From this point you can work with the query (testing, saving, modifying, etc.) as you would with one you had built yourself.


Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close