JamesHardiman
MIS
I have a bunch of records in a table. First column called ValueDate, created thus:
INSERT INTO tblStockValues SELECT getdate() as ValueDate, blah blah...
If I run this from Query Analyser:
SELECT CONVERT(varchar(30), ValueDate, 113) AS blob, ProductId FROM tblStockValues
I get this:
blob ProductId
20 Aug 2003 12:01:19:530 9002
If I run this in VBA behind an access ADP form:
x = Nz(DMax("ValueDate", "tblStockValues"
, 0)
it produces this: 20/08/2003 12:01:20
Which means that this:
cn.Execute "DELETE FROM tblStockValues WHERE ValueDate='20/08/2003 12:01:20'"
(or any sensible variation thereof) doesn't get the *^%!records, due to the 0.47 second difference in times.
This, in Query analyser:
select max(ValueDate) from tblStockValues
gives this:
2003-08-20 12:01:19.530
whereas this in VB:
Set rs = OpenRS("select max(ValueDate) as x from tblStockValues", adOpenStatic, adLockReadOnly)
datTodaysValuation = rs!x
gives this:
20/08/2003 12:01:20
I've tried using FLOAT and truncating, but it gives completely silly answers!
All I'm trying to do is give the user the chance to delete the set of records with the specified DateTime on them.
Any/all help VERY gratefully received, before I put boot through computer screen.
Note: this isn't a UK Date format problem, it's a rounding/significance problem (I'm 99% sure!)
Regards,
James Hardiman
Sunsail, UK
INSERT INTO tblStockValues SELECT getdate() as ValueDate, blah blah...
If I run this from Query Analyser:
SELECT CONVERT(varchar(30), ValueDate, 113) AS blob, ProductId FROM tblStockValues
I get this:
blob ProductId
20 Aug 2003 12:01:19:530 9002
If I run this in VBA behind an access ADP form:
x = Nz(DMax("ValueDate", "tblStockValues"
it produces this: 20/08/2003 12:01:20
Which means that this:
cn.Execute "DELETE FROM tblStockValues WHERE ValueDate='20/08/2003 12:01:20'"
(or any sensible variation thereof) doesn't get the *^%!records, due to the 0.47 second difference in times.
This, in Query analyser:
select max(ValueDate) from tblStockValues
gives this:
2003-08-20 12:01:19.530
whereas this in VB:
Set rs = OpenRS("select max(ValueDate) as x from tblStockValues", adOpenStatic, adLockReadOnly)
datTodaysValuation = rs!x
gives this:
20/08/2003 12:01:20
I've tried using FLOAT and truncating, but it gives completely silly answers!
All I'm trying to do is give the user the chance to delete the set of records with the specified DateTime on them.
Any/all help VERY gratefully received, before I put boot through computer screen.
Note: this isn't a UK Date format problem, it's a rounding/significance problem (I'm 99% sure!)
Regards,
James Hardiman
Sunsail, UK