this is the code i have and i want to know what it does so i can make a query from it


Code:
Private Sub cmdCheck_Click()
Dim q As QueryDef
Dim rs As Recordset
Dim CountStr As String
Dim Count As Long
    If Len(txtFirstName) = 0 Then
        MsgBox "Please enter a first name", vbCritical, "LegalSOFT"
        Exit Sub
    End If
    
    If Len(txtLastName) = 0 Then
        MsgBox "Please enter a last name", vbCritical, "LegalSOFT"
        Exit Sub
    End If
    
    
    Set q = CurrentDB.QueryDefs("int_qGetCodeCount")
    q.Parameters("pCode") = UCase(MakeCode)
    Set rs = q.OpenRecordset
    
        If rs.RecordCount = 0 Then
            Count = 1
        Else
            Count = rs("MaxCode") + 1
        End If
    CountStr = Format(Count, "000")
    txtCode = UCase(MakeCode) & CountStr
    cmdSave.Enabled = True
    
    
    
End Sub
thanks