PC Review


Reply
Thread Tools Rate Thread

Change MS Access query from Excel

 
 
Andrew
Guest
Posts: n/a
 
      22nd Nov 2008
Hi,

Can someone please put me out of my misery. I've been working on this for
hours.

In an Access database called 'TEST.mdb' I have a query called 'qry_My_Test'.
I want to change the 'criteria'

From

SELECT Tbl_Comm_Data.DEPT_NO FROM Tbl_Comm_Data;

To

SELECT Tbl_Comm_Data.DEPT_NO, Tbl_Comm_Data.DEPT_NAME FROM Tbl_Comm_Data;

Thanks


--
Andrew
221108
 
Reply With Quote
 
 
 
 
JP
Guest
Posts: n/a
 
      23rd Nov 2008
Can't you just open Access and fix the query?

Otherwise you might need to recreate the entire query, and update the
database with it. Which means you would need access to the query to
know what's in it. Which means you should be able to just update the
query directly.

--JP


On Nov 22, 6:28 am, Andrew <And...@discussions.microsoft.com> wrote:
> Hi,
>
> Can someone please put me out of my misery. I've been working on this for
> hours.
>
> In an Access database called 'TEST.mdb' I have a query called 'qry_My_Test'.
> I want to change the 'criteria'
>
> From
>
> SELECT Tbl_Comm_Data.DEPT_NO FROM Tbl_Comm_Data;
>
> To
>
> SELECT Tbl_Comm_Data.DEPT_NO, Tbl_Comm_Data.DEPT_NAME FROM Tbl_Comm_Data;
>
> Thanks
>
> --
> Andrew
> 221108


 
Reply With Quote
 
dmoney
Guest
Posts: n/a
 
      23rd Nov 2008
are u trying to make the access query save or just trying to select more
information from the access table? Your select statement should work, but
how are u putting the information into excel? or are you. --- If you are
trying to litterally change the access querry, you cannot use a select
statement, u will need to use a create routine instead. The select statement
is used to querry the database not change it. If the dbase that you are
querrying has the fields you need then the select statement you wrote will
work fine followed by a open and recordset commands to put the data in Excel.

"Andrew" wrote:

> Hi,
>
> Can someone please put me out of my misery. I've been working on this for
> hours.
>
> In an Access database called 'TEST.mdb' I have a query called 'qry_My_Test'.
> I want to change the 'criteria'
>
> From
>
> SELECT Tbl_Comm_Data.DEPT_NO FROM Tbl_Comm_Data;
>
> To
>
> SELECT Tbl_Comm_Data.DEPT_NO, Tbl_Comm_Data.DEPT_NAME FROM Tbl_Comm_Data;
>
> Thanks
>
>
> --
> Andrew
> 221108

 
Reply With Quote
 
Andrew
Guest
Posts: n/a
 
      23rd Nov 2008
Thanks dmoney.

I thought I'd keep my question simple but I can it just created confusion
judging by the two replies I've received.

My real requirement is to update a pivot table in excel. The source data
currently comes from MS Query and has been looking at a table based on the
Dept_No.
The SQL is:
"SELECT tbl_Comm_Data.[Commitment Status],
tbl_Comm_Data.CURR_DATE FROM Tbl_Dept_No INNER JOIN tbl_Comm_Data ON
Tbl_Dept_No.The_Dept = tbl_Comm_Data.DEPT_NO;"

There are some occaisions when the query needs to be based on the following.

"SELECT tbl_Comm_Data.[Commitment Status],
tbl_Comm_Data.CURR_DATE FROM Tbl_Report_Periods INNER JOIN (Tbl_Dept_No INNER
JOIN tbl_Comm_Data ON Tbl_Dept_No.The_Dept = tbl_Comm_Data.DEPT_NO) ON
Tbl_Report_Periods.REPORT_PERIOD = tbl_Comm_Data.REPORT_PERIOD;"

I have raised a question on how to modify the SQL in MS Query but no-one has
replied. I then thought if I could change a query (qry_Excel_Data) in access
from excel I could have the pivot tables look in Access for this query and
bypass MS Query altogether.

Hope you can assist.


--
Andrew


"dmoney" wrote:

> are u trying to make the access query save or just trying to select more
> information from the access table? Your select statement should work, but
> how are u putting the information into excel? or are you. --- If you are
> trying to litterally change the access querry, you cannot use a select
> statement, u will need to use a create routine instead. The select statement
> is used to querry the database not change it. If the dbase that you are
> querrying has the fields you need then the select statement you wrote will
> work fine followed by a open and recordset commands to put the data in Excel.
>
> "Andrew" wrote:
>
> > Hi,
> >
> > Can someone please put me out of my misery. I've been working on this for
> > hours.
> >
> > In an Access database called 'TEST.mdb' I have a query called 'qry_My_Test'.
> > I want to change the 'criteria'
> >
> > From
> >
> > SELECT Tbl_Comm_Data.DEPT_NO FROM Tbl_Comm_Data;
> >
> > To
> >
> > SELECT Tbl_Comm_Data.DEPT_NO, Tbl_Comm_Data.DEPT_NAME FROM Tbl_Comm_Data;
> >
> > Thanks
> >
> >
> > --
> > Andrew
> > 221108

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between Microsoft Query (Excel) and Access Query =?Utf-8?B?SkBZ?= Microsoft Access VBA Modules 2 9th Jul 2007 09:14 AM
Query doesn't work in Access, but in Excel Microsoft Query =?Utf-8?B?S2Vu?= Microsoft Access Queries 2 21st Jun 2006 08:44 PM
export access to excel. change access & update excel at same time =?Utf-8?B?ZmFzdGNhcg==?= Microsoft Excel Misc 0 24th Jun 2005 09:27 PM
import access query to excel causes order of records to change =?Utf-8?B?Tk4=?= Microsoft Access External Data 1 24th Apr 2005 05:14 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Microsoft Access Reports 1 13th Dec 2004 07:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:44 PM.