View Single Post
  #5   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 helping me until now.

I was slightly obscure in my wording. I should have said QUEUE and ADDRESS
are both headers of the Sheet in Excel, not tables in the database.

Maybe your Access note has merit. Have to look into it. Part of the select
statement is:
select DISTINCT CONCAT("https://anURL/Display.html?id=", CONV(T.id, 10, 10))
ADDRESS,
Q.name QUEUE,

Is the ADDRESS field to much for the Microsoft Jet database engine?

I will ponder your suggestions. Thanks

Abel


"joel" wrote:

I'm using excel 2003 so sometimes things are in different locations. You are
almost there. I like the Query Edit option in excel because you can enter
your SQL one item at a time to isloate problems.

Your ORDER BY statements should be columns in your results not a table in
Access. When you do a query you should be selecting the columns You want to
be put into excel. the sort has to be one of these columns. If you want to
sort by tables then you need to add the table name as one of the columns of
the results. You need to identify the new column. Then add this new ID into
the sort. You have the option of returning to excel this new column or use
it for the query.

I often use ACCESS to debug my database problems. You may want to look at
the help in access under SORT BY. You also may want to try your SQL statment
in Access before using it in Excel. The debug messages in Access are a
little better than excel.

There is a note in access :

If you specify a field containing Memo or OLE Object data in the ORDER BY
clause, an error occurs. The Microsoft Jet database engine does not sort on
fields of these types.



"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