Option Compare Database
Private Sub btnBuffy_Click()
If IsNull(Barcode.Value) = False Then
SampleType.Value = "Buffy Coat"
TubeType.Value = "EDTA"
TubeVol.Value = "9.0"
End If
End Sub
Private Sub btnPlasma_Click()
If IsNull(Barcode.Value) = False Then
SampleType.Value = "Plasma"
TubeType.Value = "EDTA"
TubeVol.Value = "9.0"
End If
End Sub
Private Sub btnSerum_Click()
If IsNull(Barcode.Value) = False Then
SampleType.Value = "Serum"
TubeType.Value = "Serum"
TubeVol.Value = "7.5"
End If
End Sub
Private Sub btnWhole_Click()
If IsNull(Barcode.Value) = False Then
SampleType.Value = "Whole Blood"
TubeType.Value = "EDTA"
TubeVol.Value = "2.6"
End If
End Sub
Private Sub btnCheckOut_Click()
If IsNull(TimeCollected.Value) = True Then
MsgBox "Please check-in a sample first."
ElseIf IsNull(TimeCollected.Value) = False Then
CollectedBy.Value = "Ania"
BoxName.Value = "Serum and Plasma"
Destination.Value = "CRI"
CheckOutDate.Value = Date
If Len(Nz(Me!BoxNo)) = 0 Then
MsgBox "Please enter a box."
Me!txtBoxNo.SetFocus
ElseIf Len(Nz(Me!Row)) = 0 Then
Dim intRow As Integer
Dim intPos As Integer
intRow = Nz(DMax("Row", "BloodSampleTBL", _
"BoxNo=""" & Me!BoxNo & """"), 1)
intPos = Nz(DMax("Position", "BloodSampleTBL", _
"BoxNo=""" & Me!BoxNo & """ And Row=" & intRow), 0)
If intRow = 10 And intPos = 10 Then
MsgBox "This Box is full." & vbNewLine _
& "Please enter a different Box Number."
Me!txtBoxNo.SetFocus
Else
Select Case intPos
Case 10
intRow = intRow + 1
intPos = 1
Case Is < 10
intPos = intPos + 1
End Select
With Me
!Row = intRow
!Position = intPos
End With
End If
End If
End If
End If
End Sub
Private Sub Comments_GotFocus()
DoCmd.RunCommand acCmdZoomBox
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me!Row) < 1 Or Nz(Me!Row) > 10 Then
MsgBox "Invalid value for the Box Row."
Cancel = True
ElseIf Nz(Me!Position) < 1 Or Nz(Me!Position) > 10 Then
MsgBox "Invalid value for the Position."
Cancel = True
End If
End Sub
Private Sub Form_Current()
If Me.Barcode = 0 Or IsNull(Me.Barcode) Then
Me.Barcode = Nz(DMax("Barcode", "BloodSampleTBL"), 95000) + 1
End If
End Sub
Private Sub Position_GotFocus(Cancel As Integer)
If Len(Nz(Me!BoxNo)) = 0 Then
MsgBox "Please enter a box."
Me!txtBoxNo.SetFocus
ElseIf Len(Nz(Me!Row)) = 0 Then
MsgBox "No Row value entered."
Me!txtRow.SetFocus
End If
End Sub