I am try to trap to make sure the user filled in all the fields that are req.
So I did an check on the next button to do a query on the table to check to see if there is any null values.
It looks like it works the frist time but then after it dosent
Can someone look at my code and see if I am doing something dumb.
Thanks for the help
So I did an check on the next button to do a query on the table to check to see if there is any null values.
It looks like it works the frist time but then after it dosent
Can someone look at my code and see if I am doing something dumb.
Thanks for the help
Code:
Private Sub cmdnext_Click()
On Error GoTo Err_cmdnext_Click
Dim strloanid As String
Dim strreg As String
Dim dbs As Database
Dim rst As Recordset
Dim strsql As String
strloanid = Me.LoanID.Value
strreg = Me.ModName.Value
Set dbs = CurrentDb()
strsql = "select * from tblresults where LoanID = " & " '" & strloanid & "'" & " And ModName = " & " '" & strreg & "'" & " and answer IS NULL"
' MsgBox strsql
Set rst = dbs.OpenRecordset(strsql)
'Set rst = dbs.OpenRecordset("qry_search_ans")
'rst.MoveFirst
'rst.MoveLast
'If rst.RecordCount <> 0 Then
' MsgBox rst.RecordCount
'End If
If rst.EOF Then
DoCmd.GoToRecord , , acNext
Else
' rst.MoveLast
' rst.MoveFirst
' If rst.RecordCount > 0 Then
MsgBox "Please check all answers to make sure you have answered all the questions"
' End If
End If
rst.Close
Set dbs = Nothing
Set rst = Nothing
Exit_cmdnext_Click:
Exit Sub
Err_cmdnext_Click:
MsgBox Err.Description
Resume Exit_cmdnext_Click
End Sub