0

I'm trying to write an update script to update missing values.

    Function InsertAny()
    MsgBox ("Hello")

    callAgain
End Function

Function callAgain()
    Dim alertTime As String
    alertTime = Now + TimeValue("00:00:03")
    Forms("HiddenForm1").OnTime alertTime, "InsertAny"
    'Forms("HiddenForm1").TimerInterval = 3

End Function

However I keep getting :

Run-time error '2465': Application-defined or object-defined error.

R3uK
  • 14,417
  • 7
  • 43
  • 77
Thrys5
  • 71
  • 2
  • 11
  • It is `Application.OnTime` and you better read this : http://www.cpearson.com/excel/OnTime.aspx and see another example here : http://stackoverflow.com/questions/33741488/cannot-run-the-macro/33751263#33751263 , because it is not the right way to use `OnTime` – R3uK Dec 10 '15 at 15:44
  • It says 'method or datamember not found' for `OnTime` – Thrys5 Dec 10 '15 at 15:53
  • https://www.google.fr/search?q=ms+access+OnTime&oq=ms+access+OnTime&aqs=chrome..69i57j0l5.7247j0j4&sourceid=chrome&es_sm=122&ie=UTF-8 and http://stackoverflow.com/questions/13848608/how-to-trigger-ms-access-code-based-on-specific-time-of-day-rather-than-every-se – R3uK Dec 10 '15 at 16:08
  • `Application.OnTime` exists in Excel but not in Access. – Andre Dec 10 '15 at 22:59

1 Answers1

1

In this case error 2465 appears because you used Form instead of Application. Form expects property: OnTimer, not OnTime.

Edit

As I understand, you need to call InsertAny every 3 seconds. In this case just place

Call InsertAny()

in OnTimer event of HiddenForm1 form and start timer by code

Forms("HiddenForm1").TimerInterval = 3
Sergey S.
  • 6,296
  • 1
  • 14
  • 29