[AccessD] Help, date diff

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Wed Oct 8 21:59:41 CDT 2003


Hey Group
I have to do procedure that checks if macro was already executed today (in
the last 14 hrs) and if yes doesn't do it again. I am taking last time it
was created from a table that contains only one record. Can someone please
remind me on how do I put the new value back into the table ? Write now I
get the error message that current database doesn't support update...
Also, do  Ineed to use ADO, or can do without if the table with date value
is in the same database ?

Option Compare Database
Dim ss As New ADODB.Connection
Dim rr As New ADODB.Recordset
Dim last_time As Date
Dim nnow As Date
Dim andy


Private Sub Command1_Click()
ss.ConnectionString = "DSN=Gina"
ss.Open
Set rr = ss.Execute("select * from Table1")

last_time = rr("gina")
nnow = Now()

andy = DateDiff("h", last_time, nnow)

If andy > 14 Then
 'XXX
  rr("gina").Value = nnow
   Else
    MsgBox ("The function was already performed today")
End If

End Sub


-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail




More information about the AccessD mailing list