2016-04-21 78 views
1

你好,我想顯示一種形式,顯示在此onclick事件進行查詢的進度:如何使用進度條onclick事件

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 

我已經使用ActiveXControl微軟進度控制試過,6.0版本沒有運氣。當我點擊按鈕來運行代碼時,進度條不會移動。任何幫助將不勝感激。先謝謝你。

+2

我沒有看到任何引用該snippit中的進度條的東西。 – Sorceri

+0

我以前從未使用過進度條,所以如何參考進度條以及在哪裏 – SikRikDaRula

+1

您可能想要檢查此問題以尋求進度條幫助,此處包含大量信息,或者查看msdn,我發現了一些有關在谷歌上創建進度條的文章:http://stackoverflow.com/questions/11956834/progress-bar-in-in-ms-access – MoondogsMaDawg

回答

0

我真的沒有看到任何真正的方法來判斷進度,而不是在每個步驟的宿舍中定義它。所以如果你添加一個Active x進度條,並且調用ProgressBar1,那麼你可以這樣做來更新它

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