1

Hello I am trying to display a form that shows the progress of the queries performed in this onclick event:

Private Sub Command125_Click()

          '***************Statement Covers Period 104.03*****************
Dim countOfDays As Integer
Dim lngRed As Long

lngRed = RGB(255, 0, 0)

 countOfDays = DateDiff("d", Me.admit_date, Me.from_date)

 If countOfDays > 3 Then
    Me.from_date.ForeColor = lngRed
    Me.Label126.Visible = True
    'Select all lines on IS that contain a DOS 3 days prior
    'to the date of admission and enter reason code 104.03

    If FileExists("M:\A_Audit\Client_" & [Forms]![frmClients]![CLIENT_ID] & "\Client_" & [Forms]![frmClients]![CLIENT_ID] & ".xlsx") Then
        DoCmd.SetWarnings (False)
        DoCmd.OpenQuery ("qryErrorCode104-03")
        DoCmd.SetWarnings (True)

    Else
         MsgBox "Please upload Itemized Statement to identify more than 3 days" & _
    "discrepancy between statement from date and admission date."

    End If

End If

 '***************Diagnosis code incorrect for patients age 104.07*****************
Dim Count As Integer
DoCmd.SetWarnings (False)
DoCmd.OpenQuery ("qryErrorCode104-07 -1")
Count = DCount("*", "qryErrorCode104-07 -2")
If Count > 0 Then
Me.Label123.Visible = True
End If
DoCmd.DeleteObject acTable, "tmp10407"
DoCmd.SetWarnings (True)

  '***************Diagnosis code incorrect for patients sex 104.08*****************

DoCmd.SetWarnings (False)
DoCmd.OpenQuery ("qryErrorCode104-08 -1")
Count = DCount("*", "qryErrorCode104-08 -2")
If Count > 0 Then
Me.Label124.Visible = True
End If
DoCmd.DeleteObject acTable, "tmp10408"
DoCmd.SetWarnings (True)

End Sub

I have tried using the ActiveXControl Microsoft ProgressBar Control, version 6.0 with no luck. When I click the button to run code the progressbar doesnt move. Any help would be greatly appreciated. Thank you in advance.

SikRikDaRula
  • 133
  • 1
  • 14
  • 2
    I don't see anything that references a progress bar in that snippit. – Sorceri Apr 21 '16 at 18:42
  • Ive never used a progress bar before so how would I reference the progress bar and where – SikRikDaRula Apr 21 '16 at 18:54
  • 1
    You might want to check this question for help with a progress bar, there's a lot of info packed in here, or check msdn, I found a few articles related to creating progress bars on google: http://stackoverflow.com/questions/11956834/progress-bar-in-in-ms-access – MoondogsMaDawg Apr 21 '16 at 19:54

1 Answers1

0

I really don't see any really way to judge the progress other than defining it in quarters for each step. So if you add a Active x progressbar and it is call ProgressBar1 then you could do something such as this to update it

Private Sub Command125_Click()

Me.ProgressBar1.Value = 25 'we are at the first leg so set to 25
DoEvents
          '***************Statement Covers Period 104.03*****************
Dim countOfDays As Integer
Dim lngRed As Long

lngRed = RGB(255, 0, 0)

 countOfDays = DateDiff("d", Me.admit_date, Me.from_date)

 If countOfDays > 3 Then
    Me.from_date.ForeColor = lngRed
    Me.Label126.Visible = True
    'Select all lines on IS that contain a DOS 3 days prior
    'to the date of admission and enter reason code 104.03

    If FileExists("M:\A_Audit\Client_" & [Forms]![frmClients]![CLIENT_ID] & "\Client_" & [Forms]![frmClients]![CLIENT_ID] & ".xlsx") Then
        DoCmd.SetWarnings (False)
        DoCmd.OpenQuery ("qryErrorCode104-03")
        DoCmd.SetWarnings (True)

    Else
         MsgBox "Please upload Itemized Statement to identify more than 3 days" & _
    "discrepancy between statement from date and admission date."

    End If

End If
Me.ProgressBar1.Value = 50 'we are at the second leg so set to 50
DoEvents
 '***************Diagnosis code incorrect for patients age 104.07*****************
Dim Count As Integer
DoCmd.SetWarnings (False)
DoCmd.OpenQuery ("qryErrorCode104-07 -1")
Count = DCount("*", "qryErrorCode104-07 -2")
If Count > 0 Then
Me.Label123.Visible = True
End If
DoCmd.DeleteObject acTable, "tmp10407"
DoCmd.SetWarnings (True)

Me.ProgressBar1.Value = 75 'we are at the 3rd leg so set to 75
DoEvents
  '***************Diagnosis code incorrect for patients sex 104.08*****************

DoCmd.SetWarnings (False)
DoCmd.OpenQuery ("qryErrorCode104-08 -1")
Count = DCount("*", "qryErrorCode104-08 -2")
If Count > 0 Then
Me.Label124.Visible = True
End If
DoCmd.DeleteObject acTable, "tmp10408"
DoCmd.SetWarnings (True)
Me.ProgressBar1.Value = 100 'We are done so set to 100

End Sub
Sorceri
  • 7,870
  • 1
  • 29
  • 38