Set a breakpoint on the line Qdf1.SQL = "SELECT ....
Then run the code until you hit the breakpoint.
Now copy and paste the SQL text to the debug window (CTRL+G) first enter a ? followed by the text "SELECT tblKUNRES.* FROM tblKUNRES WHERE KRESFORFDAT BETWEEN & varDateFrom & AND & VarDateTo &"
now press Enter.
You should now see the SQL string with all variables converted.
Copy this string to a query and try and run it there. You will very likely get more information about what is wrong. I suspect it is the date formats
Hmm Don't quite understand what you mean. Should i run this after CTRL+G?
?SELECT tblKUNRES.* FROM tblKUNRES WHERE KRESFORFDAT BETWEEN & varDateFrom & AND & VarDateTo &
It just results in the same line.
I have tried using # before and after the dates. I've even checked the textboxes and not used the textboxes but just with date. Then it works. I think its the variable that screws it up. The date in the DB is date/time in format 2015-02-13.
Qdf1.SQL = "SELECT tblKUNRES.* FROM tblKUNRES WHERE KRESFORFDAT BETWEEN #" & Format(varDateFrom, "YYYY-MM-DD") & "# AND #" & Format(varDateTo, "YYYY-MM-DD") & "#"
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.