View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Abel MacAdam Abel MacAdam is offline
external usenet poster
 
Posts: 10
Default (Excel 2007) Query Data in Database?

Hi Joel,

Thanks for your prompt response. I see a 'Finish' button in my 'Data
Connection Wizard' window, but no VIEW or EDIT QUERY option. We must be using
different transactions inside Excel.

In 2007 I choose Data: Get External Data - From Other Sources - From Data
Connection Wizard. The first window I got was the 'Data Connection Wizard',
where I choose 'Other/Advanced'. That opened the 'Data Link Properties'
windows, where I choose the 'Connection' tab. I entered my particulars for
the 'Use data source name', and 'User name' and 'Password'. In the 'Data
Connection Wizard' I choose a table. Next I had the opportunity to choose
where I wanted to put the data in the 'Import Data' window. In this window I
pressed the 'Properties' button, which brought me the 'Connection Properties'
window. In the 'Definition' tab I had the opportunity to enter the SQL query
in the 'Command text' text field. I choose the 'Command type' SQL. This
resulted in the message that I had an error in my SQL syntax at the last line
of my query (order by QUEUE, ADDRESS ASC). (QUEUE and ADDRESS are both tables
in the database I want to connect to. Maybe I'm almost there.

Is this the correct method of creating the query? Or do I have to try out
your second suggestion?

Abel

"joel" wrote:

The command text in a query is the SQL. You can add the sql as follows.

When you get to the last menu in the query (the one with the box FINISH)
select the VIEW or EDIT QUERY option. Then press finish

the query editor will appear. Look for the button with SQL. You can edit
the query here.

Another method if you already have aquery is to select some data in the
query. Then go to the menu Data - Import External Data and you will see the
Edit Query option enabled. Select this option and the find the SQL button.

"Abel MacAdam" wrote:

Hi all,

I want to query data in a database in Excel. And I'm not exactly (actually
exactly not) sure how to get it done.

I opened the Data part of the buttons thingy, choose 'Get external data',
and next 'From other Sources'. I filled in the required information (like
database location, and username and password combination). In the next window
I selected a table, and the end result was that I imported the complete
table. And that is not what I was aiming on.

What I wanted to accomplish was to write a query using SQL. I have the query
available. What I now have to do is find the window where I can enter the
query. Do you know?

Abel