ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date problem in a SELECT sql statement (https://www.excelbanter.com/excel-programming/384502-date-problem-select-sql-statement.html)

Christina

Date problem in a SELECT sql statement
 
Hi everyone,

I have a problem that I cannot figure out , please help me.
I have a colum J that contain the date such as 25/9/2005 0:00:00 (those date
come from a select in my Access database). Then, I want to use those date in
another select as follow:
SQL.REQUEST(Conx,,4,"Select mesure from piezo where no_site like '" & $M$14
& "' and date_piezo = DATEVALUE(" & J23 & ")")
As I know, this SELECT must return the mesure value, However it does not
return any value.

Any help will be appreciated
Regards,

NickHK

Date problem in a SELECT sql statement
 
Christina,
Check the actual string that you are sending. It looks as if it is something
like:
Select mesure from piezo where no_site like 'Some Value' and date_piezo =
DATEVALUE(39073)

whereas I guess you need something like:
"Select mesure from piezo where no_site like '" & $M$14 & "' and date_piezo
= " & DATEVALUE( J23 )

Also are the field names spelt correctly ?

NickHK

"Christina" wrote in message
...
Hi everyone,

I have a problem that I cannot figure out , please help me.
I have a colum J that contain the date such as 25/9/2005 0:00:00 (those

date
come from a select in my Access database). Then, I want to use those date

in
another select as follow:
SQL.REQUEST(Conx,,4,"Select mesure from piezo where no_site like '" &

$M$14
& "' and date_piezo = DATEVALUE(" & J23 & ")")
As I know, this SELECT must return the mesure value, However it does not
return any value.

Any help will be appreciated
Regards,




Christina

Date problem in a SELECT sql statement
 
Hi Nick,

Thank for your help. I follow your way and it works correctly. Thanks
again....

Regards,
Christina

"NickHK" wrote:

Christina,
Check the actual string that you are sending. It looks as if it is something
like:
Select mesure from piezo where no_site like 'Some Value' and date_piezo =
DATEVALUE(39073)

whereas I guess you need something like:
"Select mesure from piezo where no_site like '" & $M$14 & "' and date_piezo
= " & DATEVALUE( J23 )

Also are the field names spelt correctly ?

NickHK

"Christina" wrote in message
...
Hi everyone,

I have a problem that I cannot figure out , please help me.
I have a colum J that contain the date such as 25/9/2005 0:00:00 (those

date
come from a select in my Access database). Then, I want to use those date

in
another select as follow:
SQL.REQUEST(Conx,,4,"Select mesure from piezo where no_site like '" &

$M$14
& "' and date_piezo = DATEVALUE(" & J23 & ")")
As I know, this SELECT must return the mesure value, However it does not
return any value.

Any help will be appreciated
Regards,






All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com