How to fire an event at a future date?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm a beginner-intermediate level VBA coder and I need to write an Access
procedure that will run based on a (future) date stored in a linked SQL
Server 2000
table. I am kind of struggling with how/where to begin. Does anyone who
reads this post have a suggestion on how to accomplish this?

It would be pretty straightforward like running an UPDATE statement that
sets 2 bit flags and writes a date in an existing column. The event I use
now fires off On Click of a button, so I was thinking I'd reuse that code in
my
basProcedures module, then call it when the date matches or is past Now(). I
think I have the elements identified, it's a matter of putting them
together....... :)

-Aaron
 
Aaron,

A couple of questions:
call it when the date matches or is past Now().
Matches what, today's date?

When do you want this to happen?
When you open the database, a specific form, or where?

Can you post the current code?
 
Hi Aaron,

You need an event table that is processed at specific intervals with events
in it, and you are looking for events that have not been auctioned and are
past a specific time and date.

Create a Table = TblEvents
pEvent_No numeric primaryKey autonumber
Event_Date date
Event_Description string
Event_Actioned yes/no
Event_Action string (what you want to happen when the time is
right, maybe a sql string or stored procedure or run a module)

Process the table with a timer event on a form say once every minute looking
for work
 
The event would fire when the date entered in the SQL table is met or passed.
I imagine I'd run the procedure when my logon screen pops up.

Here's the code I use to manually "inacivate" an employee from my db. This
is an example of a function I'd look at being able to future-date.

-----------<snip>-------------
Private Sub cmdInactivate_Click()

'Inactivate employee by toggling bits and setting TermDate
Dim strSQL As String
strSQL = "UPDATE RepInfo SET Active = 0, Commissionable = 0, TermDate =
Now()"
strSQL = strSQL & "WHERE RepInfoID = "
strSQL = strSQL & RepInfoID.Value
DoCmd.RunSQL strSQL

End Sub
-----------<snip>-------------
 
Back
Top