Results 1 to 3 of 3
  1. #1
    Tyork is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    35

    Evaluate result of sql query

    I will first explain the business problem and then discuss what I think my most efficient solution is.

    Business Problem


    I've built a multiuser database that allows tracking and reporting for daily tasks for everybody in our bookkeeping department. There are four deadlines associated with each task. I need a message to pop up when a deadline has been missed.

    Possible Solution
    Call a procedure every minute to evaluate tasks for the day. The called procedure would pass today's tasks into an array via SQL. A "for loop" would then evaluate the different tasks in the array to determine if the current time was greater than the deadline time AND if the deadline status field was blank (indicating it had not been completed).

    I'm stuck at the poing where I need to pull the results of the SQL query into the array - I'm not sure how to go about doing this. Once the array has been populated I can code the rest. This is what I have so far:

    Code:
     
    Sub CheckDeadlines()
    Dim Deadline1Array() As Integer
    Dim ArraySize As Integer
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb()
    SQLArraySize = "SELECT COUNT(*) as ArraySize FROM BMS_Occurrence WHERE day = date()"
    Set rs = db.OpenRecordset(SQLArraySize, dbOpenDynaset)
    ArraySize = rs!ArraySize
    ReDim Deadline1Array(1 To 3, 1 To ArraySize)
    SQLPopulateArray = "SELECT TaskName, Deadline1, Deadline1Status FROM BMS_Occurrence WHERE day = date()"
    Any help in solving this would be appreciated including suggesting another method. Thanks!
    Last edited by Tyork; 11-09-2010 at 05:42 PM.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    you don't need any program to find out the task which pass the deadline. A query can pick all these tasks. You may do further steps in you program with those tasks.

    The query to pick up over due tasks:
    SELECT TaskName, Deadline1, Deadline1Status FROM BMS_Occurrence WHERE Deadline1< now()

  3. #3
    Tyork is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    35
    Thanks. That's an easy solution - I don't know why I was trying to make it more difficult.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 11-08-2010, 11:09 AM
  2. HELP! Display a query result into form
    By leanne in forum Forms
    Replies: 15
    Last Post: 06-23-2010, 09:18 PM
  3. Replies: 2
    Last Post: 05-18-2010, 01:43 PM
  4. How do I determine a SQL query result?
    By Trainman in forum Database Design
    Replies: 1
    Last Post: 10-15-2009, 04:49 AM
  5. Result of Count Query not known elsewhere
    By Carole in forum Access
    Replies: 1
    Last Post: 09-07-2008, 09:39 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums