hi ravdex> I have taken a quick look at your problem. At first glance I think you will be needing another table containing \"enhed\", or are you expect every \"enhed\" to have at least one reservation?
SELECT tblBookings.enhed, tblBookings.StartDato, tblBookings.SlutDato FROM tblBookings WHERE (((tblBookings.StartDato) Not Between [Forms]![frmDates]![txtFra] And [Forms]![frmDates]![txtTil]) AND ((tblBookings.SlutDato) Not Between [Forms]![frmDates]![txtFra] And [Forms]![frmDates]![txtTil]));
In the example there is a table named tblBookings. Make a form with two fields one named txtFra and the other txtTil. Name the form frmDates.
As Imentioned in my first answer you should maybe have had another table containing all your \"enhed\". So this example assumes that all \"enhed\" have at least one reservation. If they dont then you wont see them....
ravdex> I mentioned in my first answer that I think you should have an extra table for yoour \"enhed\". This is how ytou can do it if you have this table. The table is called tblEnhed and it has only one field containing the enhed numbers you have. The field type is numeric and called enhed.
SELECT tblEnhed.enhed FROM tblEnhed WHERE NOT EXISTS (SELECT 1 FROM tblBookings WHERE tblEnhed.Enhed = tblBookings.Enhed AND (tblBookings.StartDato Between [Forms]![frmDates]![txtFra] And [Forms]![frmDates]![txtTil] OR tblBookings.SlutDato Between [Forms]![frmDates]![txtFra] And [Forms]![frmDates]![txtTil]));
Så er jeg tilbage Jeg er ked af at det har taget så lang tid og jeg skal nok spare dig for \"dårlige undskyldninger\"
Som du starter med at spøge om, så har jeg enheden i en anden tabel og har derfor brugt den sql-sætning som du har foreslået til sidst
Jeg har oprettet de forms, og tabeller, som du angiver og når jeg aktiverer qry bliver jeg bedt om at angive en enhed. Men det jo den/de som jeg gerne vil finde
Igen tusind tak for hjælpen Selve sql-en ser således ud for dem der er interesseret.
AND NOT Exists (SELECT 1 FROM T_udlejid WHERE T_Shus.husid =T_udlejid.husid AND (( [Forms]![frm_søgeform]![dtpicker7] Between [fradato] And [tildato]) OR ([Forms]![frm_søgeform]![slutdato] Between [fradato] And [tildato] or ([Forms]![frm_søgeform]![dtpicker7]< [tildato] and [forms]![frm_søgeform]![slutdato] > [tildato] ))))
Great to hear, and thanks for everything ravdex :o)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.