Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Thu Oct 9 09:07:20 CDT 2003
Thanks Stuart,
this works goo, exsept I am still not able to update the table...
With this line commented, it works
DoCmd.RunSQL "Update Date Set ldate = Now()"
Also, I'd like it to be performed on opening of the database. Is that
possible ?
Private Sub Command1_Click()
last_time = DLookup("ldate", "Date")
nnow = Now()
andy = DateDiff("h", last_time, nnow)
If andy > 14 Then
DoCmd.SetWarnings False
' DoCmd.RunSQL "Update Date Set ldate = Now()"
msgbox ("ok")
DoCmd.SetWarnings True
Else
msgbox ("The function was already performed today")
End If
End Sub
> On 8 Oct 2003 at 22:59, Oleg_123 at xuppa.com wrote:
>
>> 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...
>
> It doesn't if you get if as you have done below.
>
>> Also, do Ineed to use ADO, or can do without if the table with date
>> value is in the same database ?
>
> If the tables are either in the same mdb or linked, you can do it
> without ADO like this (assuming that Table1 is a single record "System
> File":
>
> last_time = DLookup("gina","Table1")
> nnow = Now()
> andy = DateDiff("h", last_time, nnow)
>
> If andy > 14 Then
> DoCmd.Setwarnings False
> DoCmd.RunSQL "Update Table1 Set gina = Now()"
> DoCmd.Setwarnings True
> Else
> MsgBox ("The function was already performed today")
> End If
>
> Alternatively, using ADO, you can:
>
> ss.Execute(""Update Table1 Set gina = Now()")
>
>
> --
> Stuart McLachlan
> Lexacorp Ltd
> Application Development, IT Consultancy
> http://www.lexacorp.com.pg
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail