daklem
Technical User
- Sep 28, 2003
- 23
Hi,
I have the following code in an on click event to check if all the fields in a query have data. A message box displays which fields are missing data. I continue to get a "Next withot For" error when this code runs. Any suggestions?
Private Sub cmdQueryTest_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Integer
Dim str As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("qryFormLetter",dbOpenDynaset)
rs.FindFirst "[tblPatients_PtID]=" & Me.txtPtID
str = ""
For i = 0 To rs.Fields.Count - 1
If IsNull(rs(i).Value) Then
str = str & rs(i).Name & vbCr
Next i
MsgBox "The following fields are missing data:" & vbCr _
& str
rs.Close
End Sub
Thanks
I have the following code in an on click event to check if all the fields in a query have data. A message box displays which fields are missing data. I continue to get a "Next withot For" error when this code runs. Any suggestions?
Private Sub cmdQueryTest_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Integer
Dim str As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("qryFormLetter",dbOpenDynaset)
rs.FindFirst "[tblPatients_PtID]=" & Me.txtPtID
str = ""
For i = 0 To rs.Fields.Count - 1
If IsNull(rs(i).Value) Then
str = str & rs(i).Name & vbCr
Next i
MsgBox "The following fields are missing data:" & vbCr _
& str
rs.Close
End Sub
Thanks