The following line:
Opts1 = #server_opts{port=80}.
Should be contained within a function body:
foo() ->
Opts1 = #server_opts{port=80},
...
Remember to export the function, so that you can call it from outside the module:
-export([test_records/0]).
A complete example follows:
-module(my_server).
-export([test_records/0]).
-record(server_opts, {port,
ip = "127.0.0.1",
max_connections = 10}).
test_records() ->
Opts1 = #server_opts{port=80},
Opts1#server_opts.port.