My project on Leave application is almost done, however I'm really stuck at this 
This coding happens after the combobox of Staff leave types (Annual, Medical,..) are selected.
I have 2 tables here: "Leave_Details" & "Staff".
This is the setup for my tables:-
Leave_Details have:
1) ID (integer)
2) Staff Name (string)
3) Start Date
4) End Date
5) Number of Days Leave
6) Leave Type (string)
7) Annual Leave Balance (integer)
8) Medical Leave Balance (integer)
9) Remarks
10) Approval
Staff have:
1) ID (integer)
2) Staff Name (string)
3) Annual (integer)
4) Medical (integer)
If you look at the codes above, I will have an error if DLookup returns null.
Is there a way to work around this?

This coding happens after the combobox of Staff leave types (Annual, Medical,..) are selected.
Code:
Private Sub cmbLeaveType_AfterUpdate()
Dim strSearch As String
Dim intMax, intBal As Integer
If cmbLeaveType.SelText = "Annual" Then
'Retrieves leave record from "Leave_Details" table for particular staff - returns leave "ID".
strSearch = DLookup("[ID]", "Leave_Details", "[Staff Name] = '" & Me.cmbStaffName _
& "' AND [Leave Type] = '" & Me.cmbLeaveType & "'")
If strSearch Is Null Then
'Returns the annual balance record from "Staff" table
Me.txtAnnualBalance = DLookup("[Annual]", "Staff", "[Staff Name] = '" & Me.cmbStaffName & "'")
Exit Sub
Else
'Gets the last leave record of the particular staff - returns leave "ID".
intMax = DMax("[ID]", "Leave_Details", "[Staff Name] = '" & Me.cmbStaffName & "'")
'Retrieves the annual balance from last "ID"
intBal = DLookup("[Annual Leave Balance]", "Leave_Details", "[ID] = '" & intMax & "'")
End If
Me.txtAnnualBalance = intBal
ElseIf cmbLeaveType.SelText = "Medical" Then
End If
End Sub
I have 2 tables here: "Leave_Details" & "Staff".
This is the setup for my tables:-
Leave_Details have:
1) ID (integer)
2) Staff Name (string)
3) Start Date
4) End Date
5) Number of Days Leave
6) Leave Type (string)
7) Annual Leave Balance (integer)
8) Medical Leave Balance (integer)
9) Remarks
10) Approval
Staff have:
1) ID (integer)
2) Staff Name (string)
3) Annual (integer)
4) Medical (integer)
If you look at the codes above, I will have an error if DLookup returns null.
Is there a way to work around this?