I am trying to create a new environment but it gives me some trouble. The compiler keeps telling me that I am missing a } but I don't see where it could be. Here is a code sample. Thanks for your help.
\documentclass{article}
\usepackage{multirow, tabularx}
\usepackage{xparse}
\NewDocumentEnvironment{afskriftFolketaelling}{mm}
{%
\tabularx{\textwidth}{|X|l|c|c|l|l|l|}
\hline
\multicolumn{7}{|c|}{\textbf{#1}}\\
\multicolumn{7}{|c|}{#2}\\\hline
\textbf{title} & \textbf{title} & \textbf{title} & \textbf{title} & \textbf{title} & \textbf{title} & \textbf{title}\\\hline
}
{
\endtabularx
}
\begin{document}
\begin{afskriftFolketaelling}{test1}{test2}
{
1&2&3&4&5&6&7\\\hline
}
\end{afskriftFolketaelling}
\end{document}