deleting node from linked list

hi there, im writing a program that manages linked lists. The problem im
unable to resolve is when deleting nodes from the list. I am unable to
delete the head node or a node in the middle of the list. I am using delphi
5. Any help appriciated.

Here is my delete node procedure.
List is the head node that gets passed in & stud_no is a data item in the
node that is searched for before deleting.

The entire prog in below my delete procedure

Procedure delete(var list:t_list;stud_no:integer);
Var
  prev,
  current : t_list;
Begin
  prev := list;
  current := list;
  while (current <> NIL) do
  Begin                               //delete head node
    If (stud_no = current^.number) and (prev = current) then
    Begin
      list := current^.next;
      Dispose(current);
    End;
    If (stud_no = current^.number) and (current^.next <> NIL) then
    Begin
      prev^.next := current^.next;
      dispose(current);               // delete from middle
    End;
    If (stud_no = current^.number) and (current^.next = NIL) then
    Begin
      Dispose(current);
      prev^.next := NIL;            // delete last node
    End;
    prev := current;
    current := current^.next;
  End;
End;

Heres my entire program

program Requirement1;
{$APPTYPE CONSOLE}
uses
  SysUtils;

type
  t_tree = ^search_tree;
  t_list = ^node;
  node = record
    b_tree : t_tree;
    name   : string;
    number : integer;
    next   : t_list;
  end;
  search_tree = record
    left,
    right : t_tree;
    module,
    grade : integer;
  end;
Var
  head_list : t_list;
  head_tree : t_tree;

Procedure create(var list:t_list);
Begin
  list := NIL;
End;

Procedure insert(var list:t_list;stud_name:string;stud_no:integer);
Var
  prev,
  temp,
  cur :t_list;
  finished : boolean;
Begin
  finished := false;
  prev := list;
  cur := list;
  new(temp);
  temp^.name   := stud_name;
  temp^.number := stud_no;
  if cur = NIL then
  Begin
    temp^.next := list;
    list := temp;
    finished := true;
  End
else
  while (cur <> NIL) and (NOT finished) do
  Begin
    IF temp^.name < cur^.name then
    IF (cur = list) then
    Begin
      temp^.next := list;
      list := temp;
      finished := true;
    End
  Else
    Begin
      prev^.next := temp;
      temp^.next := cur;
      finished := true;
    End
  Else
    Begin
      prev := cur;
      cur  := cur^.next;
    End;
  End;
  If (NOT finished) then
  Begin
    Prev^.next := temp;
    temp^.next := cur;
  End;
End;

Procedure delete(var list:t_list;stud_no:integer);
Var
  prev,
  current : t_list;
Begin
  prev := list;
  current := list;
  while (current <> NIL) do
  Begin                               //delete head node
    If (stud_no = current^.number) and (prev = current) then
    Begin
      list := current^.next;
      Dispose(current);
    End;
    If (stud_no = current^.number) and (current^.next <> NIL) then
    Begin
      prev^.next := current^.next;
      dispose(current);               // delete from middle
    End;
    If (stud_no = current^.number) and (current^.next = NIL) then
    Begin
      Dispose(current);
      prev^.next := NIL;            // delete last node
    End;
    prev := current;
    current := current^.next;
  End;
End;

Function count(list:t_list):integer;
Var
 counter :integer;
 temp : t_list;
Begin
  counter := 0;
  temp := list;
  If temp = NIL then
  Begin
    count := 0;
  End
Else
  Begin
    While (temp <> NIL) do
    Begin
      temp := temp^.next;
      counter := counter + 1;
    End;
  End;
  count := counter;
End;

Procedure disp_list(list:t_list);
VAR
  temp:t_list;
Begin
  temp := list;
  while temp <> NIL do
  Begin
    Writeln('Stuednt Number => ',temp^.number);
    writeln('Student Name   => ',temp^.name);
    writeln('');
    temp := temp^.next;
  End;
  write('Press Any Key To Continute');
  readln;
  writeln('');
End;

procedure menu;
Var
  menu_student :string;
  menu_number:integer;
  option : char;
  exit   :boolean;
Begin
  exit := false;
  While exit = false do
  Begin
    writeln('');
    Writeln('(1) Start new List of students');
    Writeln('(2) Insert new student into list');
    Writeln('(3) Delete Student from List');
    Writeln('(4) Count number of students in list');
    Writeln('(5) Display Student in list');
    Writeln('(6) Exit');
    Write('==> ');
    readln(option);
    case option of
      '1' :      // start new list
      Begin
        create(head_list);
      End;
      '2' :     // Insert New student into list
      Begin
        Write('Enter Student Number => ');
        Readln(menu_number);
        Write('Enter Student Name   => ');
        Readln(menu_student);
        insert(head_list,menu_student,menu_number);
      End;
      '3' :    // Delete student from list
      Begin
        Write('Enter Student Number => ');
        Readln(menu_number);
        delete(head_list,menu_number);
      End;
      '4':    // Count students in list
      Begin
        writeln('Students in list => ',count(head_list));
      End;
      '5':    // Display list
      Begin
        disp_list(head_list);
      End;
      '6' :
      Begin   // Exit
        exit := true;
      End;
   End;
  End;
End;

// --------------------------main program code-----------------------//
begin
 menu();
end.