Results 1 to 5 of 5
  1. #1
    robertmarkdudley95 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    17

    Exclamation Problems with unfinished job reminder form

    I have a piece of code as follows:



    Code:
    Private Sub Form_Load()
    'On Load of the switchboard check Jobs table for any uncompleted jobs
    
    
    Dim intStore As Integer
    
    
    'Count of uncomplete jobs that are past the Expected Completion Date
    intStore = DCount("[JobID]", "[tblJobs]", "[Finish Date] <=Now() AND [Paid?] =0")
    
    
    'If count of uncomplete jobs is zero display switchboard
    'Else display message box detailing amount of jobs
    'and give the user the option as to whether to view these or not.
        If intStore = 0 Then
                Exit Sub
                    Else
                        If MsgBox("There are " & intStore & " incomplete jobs." & _
                        vbCrLf & vbCrLf & "Would you like to see these now?", _
                        vbYesNo, "There are incomplete jobs...") = vbYes Then
                        DoCmd.Minimize
                        DoCmd.OpenForm "frmReminders", acNormal
                    Else
                Exit Sub
            End If
        End If
    
    
    End Sub
    However, regardless of how many incomplete jobs there are, it still pops up with both of the jobs in my database, even the one that has been completed, as follows:

    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	38.4 KB 
ID:	6470

    I realise that it still says Paid?. I need to sort that out. But how can I resolve this error?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would start by making the changes in RED and see what you get.
    Code:
    Private Sub Form_Load()
    'On Load of the switchboard check Jobs table for any uncompleted jobs
       Dim intStore As Integer
    
       'Count of uncomplete jobs that are past the Expected Completion Date
       '   intStore = DCount("[JobID]", "[tblJobs]", "[Finish Date] <=Now() AND [Paid?] =0")
    
       intStore = DCount("[JobID]", "[tblJobs]", "[Paid?] = False")
    
       'If count of uncomplete jobs is zero display switchboard
       'Else display message box detailing amount of jobs
       'and give the user the option as to whether to view these or not.
       If intStore <> 0 Then
          If MsgBox("There are " & intStore & " incomplete jobs." & _
                    vbCrLf & vbCrLf & "Would you like to see these now?", _
                    vbYesNo, "There are incomplete jobs...") = vbYes Then
             DoCmd.Minimize
             DoCmd.OpenForm "frmReminders", acNormal
          End If
       End If
    End Sub
    Notice that I eliminated the Exit Sub's.

  3. #3
    robertmarkdudley95 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    17
    Quote Originally Posted by RuralGuy View Post
    I would start by making the changes in RED and see what you get.
    Code:
    Private Sub Form_Load()
    'On Load of the switchboard check Jobs table for any uncompleted jobs
       Dim intStore As Integer
    
       'Count of uncomplete jobs that are past the Expected Completion Date
       '   intStore = DCount("[JobID]", "[tblJobs]", "[Finish Date] <=Now() AND [Paid?] =0")
    
       intStore = DCount("[JobID]", "[tblJobs]", "[Paid?] = False")
    
       'If count of uncomplete jobs is zero display switchboard
       'Else display message box detailing amount of jobs
       'and give the user the option as to whether to view these or not.
       If intStore <> 0 Then
          If MsgBox("There are " & intStore & " incomplete jobs." & _
                    vbCrLf & vbCrLf & "Would you like to see these now?", _
                    vbYesNo, "There are incomplete jobs...") = vbYes Then
             DoCmd.Minimize
             DoCmd.OpenForm "frmReminders", acNormal
          End If
       End If
    End Sub
    Notice that I eliminated the Exit Sub's.

    Thanks for this! I tried it, but it makes no difference. The message box is saying "There are 1 incomplete jobs", but the form is still appearing with both of the jobs in the form. I think it might have something to do with:

    Code:
    DoCmd.OpenForm "frmReminders", acNormal

  4. #4
    robertmarkdudley95 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    17
    Oh wait, it doesn't matter! I based the Reminders form on a query. I'm done!!

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Glad to hear you got it sorted.

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

Similar Threads

  1. I need a 90 day reminder
    By weadwaker in forum Programming
    Replies: 3
    Last Post: 09-25-2012, 12:49 PM
  2. Reminder message box every 3/6/9/12 months
    By Koullis in forum Programming
    Replies: 2
    Last Post: 03-28-2011, 05:29 AM
  3. Timed Pop up reminder
    By Kananelo in forum Programming
    Replies: 1
    Last Post: 03-02-2011, 12:07 PM
  4. send email reminder
    By azaz in forum Forms
    Replies: 1
    Last Post: 12-26-2010, 08:35 AM
  5. advance date reminder
    By Denis in forum Database Design
    Replies: 1
    Last Post: 11-14-2010, 07:40 AM

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