compare dates

ino_mart

Registered User.
Local time
Yesterday, 16:45
Joined
Oct 7, 2009
Messages
78
All

I need to compare two dates (with time) in Access 2010, but obviously next code does not work as excpected

if now > "#1/jan/2011 00:00:10#" then
...
end if

The code between the IF-function should activate after 10 seconds in the new year.

It seems the result is TRUE although it NOW is "31/12/2010 11:25"

regards
Ino
 
Thanks

I also was able to solve this next code
DateDiff("s", Now(), "1/1/2011 00:00:10") < Int(-10)

I have now another question

I used a timer-function wich happens every second. On my form I add a Microsoft Web Component ActiveX which shows a random FLASH-file.

The flash-movie to show is defined by a random number. The database contains a table with the time in seconds of every flash file. A new flash file is only to be shown after the current movie has ended.

For example
Flash 1 takes 55 seconds to play.
Flash 2 should only start after "now + 55 seconds".

I used code below, but this neither seems to work as expected. A new flash file is now always shown after approx 10 seconds
intnow=now 'defined as public variant
If DateDiff("s", Now(), "1/1/2011 00:00:10") < Int(-10) And intNow >= intSWFTime Then
intNow = Now
intX = Int(32 * Rnd + 1)
strSQL = "select * from tblSWF where teller = " & intX
Set rsSWF = CurrentDb.OpenRecordset("tblSWF")
rsSWF.MoveFirst
intSWFTime = DateAdd("s", rsSWF!tijd, intNow)
Me.shwTime.Navigate CurrentProject.Path & "\swf\" & intX & ".swf"
End If
 
If you place DoEvents between each play it will render Access to pause until theprevious operation has been completed.

Why are you showing random flash files on screen anyway. What does the app do?
 
The application shows a "end year countdown flash file". This flash movie should play until 10 seconds in the new year 2011. That's why I use DateDiff("s", Now(), "1/1/2011 00:00:10") < Int(-10)

Afterwards a flash file with "new year greetings" should be played. I have 32 different flash files which should be showed in a random order. Of course, every flash file needs to be played until end before next movie starts. Therefore I tried to use intNow >= intSWFTime
 
I found the probem.

I opened the table instead of the SQL-string
strSQL = "select * from tblSWF where teller = " & intX
Set rsSWF = CurrentDb.OpenRecordset("tblSWF")

should be
strSQL = "select * from tblSWF where teller = " & intX
Set rsSWF = CurrentDb.OpenRecordset(strSQL)
 

Users who are viewing this thread

Back
Top Bottom