If you ask how to do something in Access, a response will often include an SQL statement for a query. [color blue]This can be daunting for new users, but it need not be.[/color]
[color green]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.[/color]
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.
[color blue]From this point you can work with the query (testing, saving, modifying, etc.) as you would with one you had built yourself.[/color]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.