0
と次のループが機能しない理由を理解できません。私がしようとしているのは、[nts]と呼ばれる特定のフィールドの数値に応じて、同じレコード数のレポートを印刷することです。my for next loopが機能していないため、エラー94が発生する
フィールドが空白の場合、というエラーが表示されます。94フィールドに値がある場合は、エラーハンドラーに記載されています。どのような体はとても親切で、私を喜ばせることができますか?事前にありがとう:)**私は最初の問題ACCESS2007
Option Compare Database
Option Explicit
Private Sub Report_Close()
' Delete previous data from tabMeal
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete from tabAmeal"
End Sub
Private Sub Report_Load()
Dim intNOM As Integer
'NOM means number of nights meals
Dim mTimes As Integer
On Error GoTo errorhandler
intNOM = 1
mTimes = 0
mTimes = DLookup("nz([nts],0)", "tabAmeal", "[nts] > 0")
'mTimes means number of meals
If mTimes = 0 Then
MsgBox "File is empty GO to Query" & vbCrLf & "Error - Run the Query", vbQuestion
Else
'now print the information found in table "tabmeal" number of times depending on the value field "nts"
For intNOM = 1 To mTimes
DoCmd.OpenReport "repAmeal?", acViewPreview
Next intNOM
End If
errorhandler:
MsgBox "Error #:- " & Err.Number & vbCrLf & "LOOP not working" & vbCrLf & "Must find why this error" & vbCrLf & Err.Description
End Sub
Private Sub Report_NoData(Cancel As Integer)
MsgBox "Please note that you have no records to report." & vbCrLf & "You have to run the QUERY to get the required informatio."
End Sub
OK私は皆さんの提案をしました。ありがとうございました、そして今、エラーはなくなりました。ただし、レポートには、フィールドに記載されている回数が報告されません。例:クライアントガーナーは2 nts、ランズレーは3 ntsのためレポートは印刷されるはずです:Garner - Garner - Ransley - Ransley - Ransley –
@ Chev.PhilipAndrewRansley:新しい質問では、この。テーブル構造とモックアップまたはレポートの見た目の正確な記述を提供する。 ---この質問は答えがあなたの問題を解決した場合、あなたは[それを受け入れる]ことができます(http://stackoverflow.com/help/someone-answers)。 – Andre