Ok:
//First I delete old data from a temporary table.
FIND temp_smoelenboek WHERE temp_smoelenboek.UserRef=LoggedInRegularUser
DELETE temp_smoelenboek
//Then I refill the temporary table with new data with 3 querys
FIND Clubcontact WHERE Clubcontact.ClubRef=LoggedInRegularUser.RefClub AND Clubcontact.EmailAddress<>'noreply@oefenwedstrijden.nl' AND Clubcontact.EmailAddress IS DEFINED
CREATE temp_smoelenboek FOR EACH Clubcontact WITH temp_smoelenboek.ContactType=Clubcontact.ContactType, temp_smoelenboek.EmailAddress=Clubcontact.EmailAddress, temp_smoelenboek.Naam=Clubcontact.Naam, temp_smoelenboek.Telefoon=Clubcontact.Telefoon, temp_smoelenboek.Voornaam=Clubcontact.Voornaam,temp_smoelenboek.Notitie=Clubcontact.Notitie,temp_smoelenboek.UserRef=LoggedInRegularUser,temp_smoelenboek.Relatie='Club'
FIND Afdelingcontacten WHERE Afdelingcontacten.ClubAfdelingRef.ClubRef=LoggedInRegularUser.RefClub AND Afdelingcontacten.EmailAddress<>'noreply@oefenwedstrijden.nl' AND Afdelingcontacten.EmailAddress IS DEFINED
CREATE temp_smoelenboek FOR EACH Afdelingcontacten WITH temp_smoelenboek.ContactType=Afdelingcontacten.ContactType, temp_smoelenboek.EmailAddress=Afdelingcontacten.EmailAddress, temp_smoelenboek.Naam=Afdelingcontacten.Naam, temp_smoelenboek.Telefoon=Afdelingcontacten.Telefoon, temp_smoelenboek.Voornaam=Afdelingcontacten.Voornaam,temp_smoelenboek.Notitie=Afdelingcontacten.Notitie,temp_smoelenboek.UserRef=LoggedInRegularUser,temp_smoelenboek.Relatie=Afdelingcontacten.Afdeling
FIND Teamcontacten WHERE Teamcontacten.TeamRef.ClubRef=LoggedInRegularUser.RefClub AND Teamcontacten.EmailAddress IS DEFINED
CREATE temp_smoelenboek FOR EACH Teamcontacten WITH temp_smoelenboek.ContactType=Teamcontacten.ContactType, temp_smoelenboek.EmailAddress=Teamcontacten.EmailAddress, temp_smoelenboek.Naam=Teamcontacten.Naam, temp_smoelenboek.Telefoon=Teamcontacten.Telefoon, temp_smoelenboek.Voornaam=Teamcontacten.Voornaam,temp_smoelenboek.Notitie=Teamcontacten.Notitie,temp_smoelenboek.UserRef=LoggedInRegularUser,temp_smoelenboek.Relatie=Teamcontacten.TeamRef.TeamNaam
//I show the new temp data to the users, so he can pick one or more colleques. I use a query 'ZoekSmoelenBboek' for that.
PICK ONE OR MORE FROM ZoekSmoelenBoek
//Now I show a form where the user can type his mailmessage
ENTER NEW MailSjabloon USING MainZonderAan
//Then I create the Notification and copy the userdata to it
CREATE Algemeenbericht WITH Algemeenbericht.FromAddress=LoggedInRegularUser.EmailAddress,Algemeenbericht.Subject=MailSjabloon.Subject,Algemeenbericht.Message=MailSjabloon.Message,Algemeenbericht.CC=MailSjabloon.CC,Algemeenbericht.BCC=MailSjabloon.BCC
//Send the mail to the selected collegues
SEND Algemeenbericht TO temp_smoelenboek
//Show a message that the mails are send
DISPLAY MESSAGE 'Mail verzonden aan collega(s)'