Hello,
I am new here and also new to VBA for Access. I am trying to see if there is a way to test multiple conditions and return "YES" if all come back true and "NO" if any are false. I am trying to compare chemistries and need an exact match. Below is the code that is not working. Any help would be greatly appreciated.
[Code] Public Function GetInfo()
On Error GoTo ErrorHandler
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim strSql As String
strSql = "SELECT * FROM FunctionQry;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSql)
rs.MoveLast
rs.MoveFirst
Do While Not rs.EOF
'*****Evaluate Chemistry*****
If rs!InvC <= rs!StdCMax Then
If rs!InvMn >= rs!StdMnMin Then
If rs!InvMn <= rs!StdMnMax Then
If rs!InvP >= rs!StdPMin Then
If rs!InvP <= rs!StdPMax Then
If rs!InvS >= rs!StdSMin Then
If rs!InvS <= rs!StdSMax Then
If rs!InvSi >= rs!StdSiMin Then
If rs!InvSi <= rs!StdSiMax Then
rs.Edit
rs!YesNo = "YES"
rs.Update
Else
rs.Edit
rs!YesNo = "NO"
rs.Update
End If
End If
End If
End If
End If
End If
End If
End If
End If
rs.MoveNext
Loop
ErrorHandler:
Resume Next
End Function [Code]