Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Update Query from Excel VBA module

I need to run a query against a SQL DB in Excel so I can use Task Scheduler
and run the Excel File every 6 hours. I created the update query in Access.
SQL Server Name: SQL
Database: Production
Table: Job

Heres the SQL query from Access:
UPDATE Job SET Job.Priority = 0
WHERE (((Job.Job) Like "F*") AND ((Job.Status)="Active") AND
((Job.Priority)0) AND ((Job.Sched_Start) Is Not Null));
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Update Query from Excel VBA module

Excel should be able to set from the worksheet menu create the query for up
to 3 parameters. when you get to the last menu (the one with finish) select
edit query, then finish. The Query Editor will come up. Press the SQL
button. then edit the SQL to add in your 4 filter.

1) worksheet menu : Data : Import External Data - Import Data - New Database
query

2) Select Access Database and your file.

3) first menu select the columns.

4) 2nd menu set up you filters.

5) go to Finsh menu and proceed as stated above.


Yo can record a macro while performing the query. The Command Text portion
of the query is the SQL.

"gcutter" wrote:

I need to run a query against a SQL DB in Excel so I can use Task Scheduler
and run the Excel File every 6 hours. I created the update query in Access.
SQL Server Name: SQL
Database: Production
Table: Job

Heres the SQL query from Access:
UPDATE Job SET Job.Priority = 0
WHERE (((Job.Job) Like "F*") AND ((Job.Status)="Active") AND
((Job.Priority)0) AND ((Job.Sched_Start) Is Not Null));

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Update Query from Excel VBA module

Nevermind I wrote the Update query on the SQL Server and set it up to run
every morning at 1AM as a Scheduled Job Type T-SQL.

UPDATE Job Set Priority = '0'
From Job
WHERE Status ='Active' and Priority 0 and Job Like 'F%' and Sched_End Is
Not Null


"Joel" wrote:

Excel should be able to set from the worksheet menu create the query for up
to 3 parameters. when you get to the last menu (the one with finish) select
edit query, then finish. The Query Editor will come up. Press the SQL
button. then edit the SQL to add in your 4 filter.

1) worksheet menu : Data : Import External Data - Import Data - New Database
query

2) Select Access Database and your file.

3) first menu select the columns.

4) 2nd menu set up you filters.

5) go to Finsh menu and proceed as stated above.


Yo can record a macro while performing the query. The Command Text portion
of the query is the SQL.

"gcutter" wrote:

I need to run a query against a SQL DB in Excel so I can use Task Scheduler
and run the Excel File every 6 hours. I created the update query in Access.
SQL Server Name: SQL
Database: Production
Table: Job

Heres the SQL query from Access:
UPDATE Job SET Job.Priority = 0
WHERE (((Job.Job) Like "F*") AND ((Job.Status)="Active") AND
((Job.Priority)0) AND ((Job.Sched_Start) Is Not Null));

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a SQL Update Query in Excel VBA KC Excel Programming 2 July 27th 06 11:30 PM
How do I update a ODBC query in Excel using pivotTables in VBA? FCS Excel Programming 6 November 10th 05 04:47 PM
Query a Access database that has a module from Excel Oggie Excel Discussion (Misc queries) 1 January 4th 05 08:43 AM
How To Query and Update Excel Data Using ADO From ASP Stan the Mouse[_2_] Excel Programming 1 November 4th 04 09:43 AM
How access/query/update Excel using VC? Ong Hong Peow Excel Programming 1 September 21st 04 01:59 PM


All times are GMT +1. The time now is 09:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"