Hi all,
I have written a bit of straightforward code to make sure none of my fields are empty. if they are empty, a msg box comes up and alerts the user to enter information or else it wont save the record.
i have attached my code. for some reason, it does not check two of the fields: evaporation lot field, and diffusion lot field. everything else works fine.
it is worth noting that, the evaporation and diffusion fields are auto populated upon selecting an entry from the Work Order combo box.
any ideas of what is going on?
Code:Private Function CheckBeforeSaving()'checks for data integrity Dim strNumStacks As String Dim intStackResponse As Integer strNumStacks = "Is this the correct number of stacks?" If IsNull(Me.CboWorkOrder) Then MsgBox "Please Select a Work Order" Me.CboWorkOrder.SetFocus CheckBeforeSaving = False ElseIf IsNull(Me.TxtPartNumber) Then MsgBox "No Part Number? Notify Engineering" Me.TxtPartNumber.SetFocus CheckBeforeSaving = False ElseIf IsNull(Me.txtEvaporationLot) Then MsgBox "No Evaporation Lot? Notify Engineering" Me.txtEvaporationLot.SetFocus CheckBeforeSaving = False ElseIf IsNull(Me.TxtDiffusionLot) Then MsgBox "No Diffusion Lot? Notify Engineering" Me.TxtDiffusionLot.SetFocus CheckBeforeSaving = False ElseIf IsNull(Me.TxtStacksBuilt) Then MsgBox "Please enter quantity of stacks being built" Me.TxtStacksBuilt.SetFocus CheckBeforeSaving = False ElseIf CInt(Me.TxtStacksBuilt) > 25 Or CInt(Me.TxtStacksBuilt) = 0 Then intStackResponse = MsgBox(strNumStacks, vbYesNo) If intStackResponse = vbYes Then CheckBeforeSaving = True Else Me.TxtStacksBuilt.SetFocus CheckBeforeSaving = False End If Else CheckBeforeSaving = True End If End Function