Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sql query in excel

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default sql query in excel

Try this in your SQL code:
Date() as RunDate

Does that help?

***********
Regards,
Ron


"ivan" wrote:

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sql query in excel

Thanks ron, but doesnt work, it says that cant show that query graphically

"Ron Coderre" wrote:

Try this in your SQL code:
Date() as RunDate

Does that help?

***********
Regards,
Ron


"ivan" wrote:

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default sql query in excel

Ivan

Nothing's really wrong. That's just a notice from MS Query that it can't
represent the RunDate field in a table so it can't show you the query
graphically. From that point on, you'll need to edit the query via the SQL
window.

Does that help?

***********
Regards,
Ron


"ivan" wrote:

Thanks ron, but doesnt work, it says that cant show that query graphically

"Ron Coderre" wrote:

Try this in your SQL code:
Date() as RunDate

Does that help?

***********
Regards,
Ron


"ivan" wrote:

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sql query in excel

i've tried but didnt work, i've tried with getday,now,etc

thanks a lot for your help

"Ron Coderre" wrote:

Ivan

Nothing's really wrong. That's just a notice from MS Query that it can't
represent the RunDate field in a table so it can't show you the query
graphically. From that point on, you'll need to edit the query via the SQL
window.

Does that help?

***********
Regards,
Ron


"ivan" wrote:

Thanks ron, but doesnt work, it says that cant show that query graphically

"Ron Coderre" wrote:

Try this in your SQL code:
Date() as RunDate

Does that help?

***********
Regards,
Ron


"ivan" wrote:

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default sql query in excel

Perhaps if you posted a little more of your SQL code and told us what kind of
database (Oracle, MS Access, SQLServer, etc) you're accessing, we'd have a
better chance of helping.

***********
Regards,
Ron


"ivan" wrote:

i've tried but didnt work, i've tried with getday,now,etc

thanks a lot for your help

"Ron Coderre" wrote:

Ivan

Nothing's really wrong. That's just a notice from MS Query that it can't
represent the RunDate field in a table so it can't show you the query
graphically. From that point on, you'll need to edit the query via the SQL
window.

Does that help?

***********
Regards,
Ron


"ivan" wrote:

Thanks ron, but doesnt work, it says that cant show that query graphically

"Ron Coderre" wrote:

Try this in your SQL code:
Date() as RunDate

Does that help?

***********
Regards,
Ron


"ivan" wrote:

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sql query in excel

this is the code
SELECT HelpDesk.Apellido, HelpDesk.Nombre, HelpDesk.Numero_de_Incidente,
HelpDesk.Fecha_de_Creacion, HelpDesk.Creado_por, HelpDesk.Assigned_to,
HelpDesk.Tipo_de_Problema, HelpDesk.Elem__Afectado, HelpDesk.Intervención
FROM HelpDesk HelpDesk
WHERE (HelpDesk.Fecha_de_Creacion={ts '2005-11-25 00:00:00'} And
HelpDesk.Fecha_de_Creacion<={ts '2005-11-26 00:00:00'}) AND
(HelpDesk.Estado<'Closed') AND (HelpDesk.Intervención<'Tarea Planificada')
AND (HelpDesk.Edificio<'Planta Chile')
ORDER BY HelpDesk.Apellido

i need to get the day i run the query.

can you help me?
Thanks a lot.

"Ron Coderre" wrote:

Perhaps if you posted a little more of your SQL code and told us what kind of
database (Oracle, MS Access, SQLServer, etc) you're accessing, we'd have a
better chance of helping.

***********
Regards,
Ron


"ivan" wrote:

i've tried but didnt work, i've tried with getday,now,etc

thanks a lot for your help

"Ron Coderre" wrote:

Ivan

Nothing's really wrong. That's just a notice from MS Query that it can't
represent the RunDate field in a table so it can't show you the query
graphically. From that point on, you'll need to edit the query via the SQL
window.

Does that help?

***********
Regards,
Ron


"ivan" wrote:

Thanks ron, but doesnt work, it says that cant show that query graphically

"Ron Coderre" wrote:

Try this in your SQL code:
Date() as RunDate

Does that help?

***********
Regards,
Ron


"ivan" wrote:

im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query?

get day() doesnt work.

a query error appears!

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default sql query in excel

There are 2 ways to solve this:

create a new column in your select clause that gives the current
day/time. The function to do this depends on the DBMS. e.g. for SQL
server this is "getdate()"

so "Select getdate() as CurrentDate, ...... from ...." would work on
SQL Server.

If your query gives more that 1 record you will see the date for each
line (maybe not want you want).

With VBA it would look something like this:

In Thisworkbook module:

Dim Withevents qtb as QueryTable

Sub Workbook_Open

Set qtb = Thisworkbook.Sheets("Mysheet").QueryTables("Mytabl e")

End Sub


qtb_AfterRefresh(bSuccess as boolean)

if bSuccess then Range("Mysheet!A1") = Now()

End Sub

This code would update A1 with current date after a succesful refresh.


DM Unseen

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sql query in excel

Thanks for the info, the problem is i am working with remedy.
There i can use $date$ to replace the day but doesnt work in the microsoft
query

"DM Unseen" wrote:

There are 2 ways to solve this:

create a new column in your select clause that gives the current
day/time. The function to do this depends on the DBMS. e.g. for SQL
server this is "getdate()"

so "Select getdate() as CurrentDate, ...... from ...." would work on
SQL Server.

If your query gives more that 1 record you will see the date for each
line (maybe not want you want).

With VBA it would look something like this:

In Thisworkbook module:

Dim Withevents qtb as QueryTable

Sub Workbook_Open

Set qtb = Thisworkbook.Sheets("Mysheet").QueryTables("Mytabl e")

End Sub


qtb_AfterRefresh(bSuccess as boolean)

if bSuccess then Range("Mysheet!A1") = Now()

End Sub

This code would update A1 with current date after a succesful refresh.


DM Unseen


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default sql query in excel

Is the $date$ function available through ODBC drivers? if so this might
be an issue with MSQuery.

Maybe edit your query directly through VBA or another tool?

I not, use the VBA solution.

Dm Unseen

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
Excel 2007 / MS Query - editing existing query to another sheet Hotpepperz Excel Discussion (Misc queries) 0 June 13th 08 06:53 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 1 November 29th 05 01:44 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 0 November 28th 05 06:37 PM
Edit Query from Excel will not open query in MSQuery Michelle Excel Programming 0 February 21st 05 03:59 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 11:12 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"