Bash and seq, 132 bytes
b(){ echo -n "|";for i in $(seq 3 $1);do echo -n "$2";done;echo "|";} r(){ b $1 "-";for i in $(seq 3 $2);do b $1 " ";done;b $1 "-";} Use calling r, like r 8 4:
|------| | | | | |------| Update with manatwork suggestions, reducing to 108 byte (not EOL in the last line):
b(){ echo "|`for i in $(seq 3 $1);{ echo -n "$2";}`|";} r(){ b $1 -;for i in `seq 3 $2`;{ b $1 \ ;};b $1 -;}