K
Kirk P.
I wrote this code that works fine:
Function CheckforNull()
Dim db As Database
Dim rec As Recordset
Dim intRecords As Integer
Set db = CurrentDb
Set rec = db.OpenRecordset("SELECT INVI_RESP_FOR_ID, PROD_ID " _
& "FROM OnHandInv " _
& "WHERE (((OnHandInv.TOTAL_PO_COST_PER)Is
Null)) " _
& "GROUP BY INVI_RESP_FOR_ID, PROD_ID",
dbOpenDynaset)
rec.MoveLast
intRecords = rec.RecordCount
If intRecords > 0 Then
MsgBox "You have " & intRecords & " invalid (null)" _
& " records in table OnHandInv" _
& vbNewLine & "Delete these records and start over!", _
vbOKOnly + vbInformation
End If
rec.Close
End Function
Trouble is, I'm calling this function from another function. This functions
runs first and correctly displays the MsgBox I want. When I click OK, it
continues processing the function that called it. What I really want is when
I click OK, the function ends right there and does NOT continue.
Function CheckforNull()
Dim db As Database
Dim rec As Recordset
Dim intRecords As Integer
Set db = CurrentDb
Set rec = db.OpenRecordset("SELECT INVI_RESP_FOR_ID, PROD_ID " _
& "FROM OnHandInv " _
& "WHERE (((OnHandInv.TOTAL_PO_COST_PER)Is
Null)) " _
& "GROUP BY INVI_RESP_FOR_ID, PROD_ID",
dbOpenDynaset)
rec.MoveLast
intRecords = rec.RecordCount
If intRecords > 0 Then
MsgBox "You have " & intRecords & " invalid (null)" _
& " records in table OnHandInv" _
& vbNewLine & "Delete these records and start over!", _
vbOKOnly + vbInformation
End If
rec.Close
End Function
Trouble is, I'm calling this function from another function. This functions
runs first and correctly displays the MsgBox I want. When I click OK, it
continues processing the function that called it. What I really want is when
I click OK, the function ends right there and does NOT continue.